Skip to content

Commit bebd034

Browse files
refactor(web): lift GitHubIcon into a shared component
AppHeader.tsx and LoginPlaceholder.tsx carried byte-identical copies of the same SVG. One component under components/icons/ keeps the path data in a single place for the next screen that needs it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RdRwHvDupRLV8GuJpYKzEr
1 parent 9201cbe commit bebd034

3 files changed

Lines changed: 17 additions & 30 deletions

File tree

‎apps/web/src/components/AppHeader.tsx‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
} from '@/components/ui/sheet';
1818
import { Separator } from '@/components/ui/separator';
1919
import { SearchBox } from '@/components/SearchBox';
20+
import { GitHubIcon } from '@/components/icons/GitHubIcon';
2021
import { useAuth } from '@/hooks/useAuth';
2122

2223
const GITHUB_URL = 'https://github.com/CodeForPhilly';
@@ -61,21 +62,6 @@ function MenuIcon() {
6162
);
6263
}
6364

64-
function GitHubIcon() {
65-
return (
66-
<svg
67-
xmlns="http://www.w3.org/2000/svg"
68-
width="18"
69-
height="18"
70-
viewBox="0 0 24 24"
71-
fill="currentColor"
72-
aria-hidden="true"
73-
>
74-
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
75-
</svg>
76-
);
77-
}
78-
7965
function AuthControls({ mobile = false }: { mobile?: boolean }) {
8066
const { person, loading, signOut } = useAuth();
8167

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/** GitHub mark, sized to sit inline with text and icon buttons. */
2+
export function GitHubIcon() {
3+
return (
4+
<svg
5+
xmlns="http://www.w3.org/2000/svg"
6+
width="18"
7+
height="18"
8+
viewBox="0 0 24 24"
9+
fill="currentColor"
10+
aria-hidden="true"
11+
>
12+
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
13+
</svg>
14+
);
15+
}

‎apps/web/src/pages/LoginPlaceholder.tsx‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
import { Button } from '@/components/ui/button';
1111
import { Input } from '@/components/ui/input';
1212
import { Label } from '@/components/ui/label';
13+
import { GitHubIcon } from '@/components/icons/GitHubIcon';
1314
import { useAuth } from '@/hooks/useAuth';
1415
import { api, ApiError } from '@/lib/api';
1516

@@ -46,21 +47,6 @@ const ERROR_MESSAGES: Record<ErrorCode, React.ReactNode> = {
4647
),
4748
};
4849

49-
function GitHubIcon() {
50-
return (
51-
<svg
52-
xmlns="http://www.w3.org/2000/svg"
53-
width="18"
54-
height="18"
55-
viewBox="0 0 24 24"
56-
fill="currentColor"
57-
aria-hidden="true"
58-
>
59-
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
60-
</svg>
61-
);
62-
}
63-
6450
function WhyGitHub() {
6551
const [open, setOpen] = useState(false);
6652

0 commit comments

Comments
 (0)