Skip to content

Commit 807668f

Browse files
feat(button): replace Google icon with inline SVG (#272)
1 parent 74bcea7 commit 807668f

File tree

4 files changed

+60
-60
lines changed

4 files changed

+60
-60
lines changed

components/button/button.module.scss

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,17 @@ $radius: 4px;
2626
}
2727

2828
.googleLogo {
29-
background-image: url(./svgs/google.svg);
3029
background-color: #fff;
31-
background-repeat: no-repeat;
32-
background-position: center;
33-
background-size: 45px;
3430
position: absolute;
3531
height: $height - 4px;
3632
width: $height - 4px;
3733
border-top-left-radius: $radius;
3834
border-bottom-left-radius: $radius;
3935
top: 2px;
4036
left: 2px;
37+
display: flex;
38+
align-items: center;
39+
justify-content: center;
4140
}
4241

4342
.arrowButton :global(.mdc-button__label) {

components/button/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import Link from 'next/link';
77
import { useMemo } from 'react';
88
import cn from 'classnames';
99

10+
import GoogleIcon from 'components/icons/google';
11+
1012
import Arrow from './arrow';
1113
import styles from './button.module.scss';
1214

@@ -35,7 +37,11 @@ export default function Button({
3537
[styles.googleButton]: google,
3638
})}
3739
>
38-
{google && <div className={styles.googleLogo} />}
40+
{google && (
41+
<div className={styles.googleLogo}>
42+
<GoogleIcon />
43+
</div>
44+
)}
3945
{children}
4046
{arrow && <Arrow className={styles.arrowIcon} />}
4147
</MDCButton>

components/button/svgs/google.svg

Lines changed: 0 additions & 55 deletions
This file was deleted.

components/icons/google.tsx

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
export default function Google(): JSX.Element {
2+
return (
3+
<svg
4+
width='40'
5+
height='40'
6+
version='1.1'
7+
viewBox='0 0 40 40'
8+
xmlns='http://www.w3.org/2000/svg'
9+
>
10+
<g transform='translate(-3,-3)' fill='none' fillRule='evenodd'>
11+
<g transform='translate(-1,-1)'>
12+
<g transform='translate(4,4)'>
13+
<g>
14+
<use
15+
width='100%'
16+
height='100%'
17+
fill='#ffffff'
18+
fillRule='evenodd'
19+
/>
20+
<g fill='none'>
21+
<use width='100%' height='100%' />
22+
<use width='100%' height='100%' />
23+
<use width='100%' height='100%' />
24+
</g>
25+
</g>
26+
</g>
27+
<g transform='translate(15,15)'>
28+
<path
29+
d='m17.64 9.2045c0-0.63818-0.05727-1.2518-0.16364-1.8409h-8.4764v3.4814h4.8436c-0.20864 1.125-0.84273 2.0782-1.7959 2.7164v2.2582h2.9086c1.7018-1.5668 2.6836-3.8741 2.6836-6.615z'
30+
fill='#4285f4'
31+
/>
32+
<path
33+
d='m9 18c2.43 0 4.4673-0.80591 5.9564-2.1805l-2.9086-2.2582c-0.80591 0.54-1.8368 0.85909-3.0477 0.85909-2.3441 0-4.3282-1.5832-5.0359-3.7105h-3.0068v2.3318c1.4809 2.9414 4.5245 4.9582 8.0427 4.9582z'
34+
fill='#34a853'
35+
/>
36+
<path
37+
d='m3.9641 10.71c-0.18-0.54-0.28227-1.1168-0.28227-1.71s0.10227-1.17 0.28227-1.71v-2.3318h-3.0068c-0.60955 1.215-0.95727 2.5895-0.95727 4.0418 0 1.4523 0.34773 2.8268 0.95727 4.0418z'
38+
fill='#fbbc05'
39+
/>
40+
<path
41+
d='m9 3.5795c1.3214 0 2.5077 0.45409 3.4405 1.3459l2.5814-2.5814c-1.5586-1.4523-3.5959-2.3441-6.0218-2.3441-3.5182 0-6.5618 2.0168-8.0427 4.9582l3.0068 2.3318c0.70773-2.1273 2.6918-3.7105 5.0359-3.7105z'
42+
fill='#ea4335'
43+
/>
44+
<path d='m0 0h18v18h-18z' />
45+
</g>
46+
</g>
47+
</g>
48+
</svg>
49+
);
50+
}

0 commit comments

Comments
 (0)