Skip to content

Commit d5fa895

Browse files
Slashgearclaude
andcommitted
fix: use dynamic origin for press kit logo copy links
Resolve copy URLs client-side using window.location.origin instead of a hardcoded production BASE_URL, so preview and local environments get correct links while keeping the page statically rendered. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 31eb755 commit d5fa895

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

modules/press-kit/CopyButton.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import { Copy } from '../icons/Copy';
55
import { Check } from '../icons/Check';
66
import styles from './PressKit.module.css';
77

8-
export function CopyButton({ value, label = 'Copier le lien' }: { value: string; label?: string }) {
8+
export function CopyButton({ value, path, label = 'Copier le lien' }: { value?: string; path?: string; label?: string }) {
99
const [copied, setCopied] = useState(false);
1010

1111
const handleCopy = async () => {
12-
await navigator.clipboard.writeText(value);
12+
const text = path ? `${window.location.origin}${path}` : value ?? '';
13+
await navigator.clipboard.writeText(text);
1314
setCopied(true);
1415
setTimeout(() => setCopied(false), 2000);
1516
};

modules/press-kit/LogoCard.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { CopyButton } from './CopyButton';
44
import { DownloadButton } from './DownloadButton';
55
import styles from './PressKit.module.css';
66

7-
const BASE_URL = 'https://www.lyonjs.org';
8-
97
function groupVariants(variants: LogoVariant[]) {
108
const vector: LogoVariant[] = [];
119
const png: LogoVariant[] = [];
@@ -47,7 +45,7 @@ export function LogoCard({ logo }: { logo: LogoAsset }) {
4745
<span className={styles.variantFormat}>{variant.format}</span>
4846
<div className={styles.variantActions}>
4947
<DownloadButton href={variant.filePath} label="Télécharger" />
50-
<CopyButton value={`${BASE_URL}${variant.filePath}`} label="Copier le lien" />
48+
<CopyButton path={variant.filePath} label="Copier le lien" />
5149
</div>
5250
</div>
5351
))}

0 commit comments

Comments
 (0)