Skip to content

Commit 1859723

Browse files
author
Lailo
committed
adds tailwind color alias
for primary and secondary
1 parent 120d91e commit 1859723

File tree

7 files changed

+33
-13
lines changed

7 files changed

+33
-13
lines changed

src/components/Button.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ const Button: React.FC<Props & React.HTMLProps<HTMLButtonElement>> = ({
2020
'px-4 py-2',
2121
{ 'text-white': !disabled, 'text-gray-500 dark:text-gray-700': disabled },
2222
{
23-
'bg-green-700 hover:bg-green-800': !disabled && type === 'primary',
24-
'bg-blue-700 hover:bg-blue-800': !disabled && type === 'secondary',
23+
'bg-primary hover:bg-primary-darker': !disabled && type === 'primary',
24+
'bg-secondary hover:bg-secondary-darker':
25+
!disabled && type === 'secondary',
2526
'bg-gray-300 dark:bg-gray-800': disabled,
2627
},
2728
{

src/components/Dropdown.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ const Dropdown: React.FC<Props> = ({ className, buttonLabel, children }) => {
3030
<div ref={node} className={clsx('relative inline-block', className)}>
3131
<button
3232
className={clsx('p-2 rounded-full', {
33-
'hover:bg-green-700 hover:bg-opacity-25': !showDropdown,
34-
'bg-green-700 text-white': showDropdown,
33+
'hover:bg-primary hover:bg-opacity-25': !showDropdown,
34+
'bg-primary text-white': showDropdown,
3535
})}
3636
onClick={toggleDropdown}
3737
>

src/components/__snapshots__/Button.test.tsx.snap

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ exports[`Button matches loading state 1`] = `
2121

2222
exports[`Button matches primary (default) type snapshot 1`] = `
2323
<button
24-
className="px-4 py-2 text-white bg-green-700 hover:bg-green-800"
24+
className="px-4 py-2 text-white bg-primary hover:bg-primary-darker"
2525
disabled={false}
2626
>
2727
Primary
@@ -30,7 +30,7 @@ exports[`Button matches primary (default) type snapshot 1`] = `
3030

3131
exports[`Button matches secondary type snapshot 1`] = `
3232
<button
33-
className="px-4 py-2 text-white bg-blue-700 hover:bg-blue-800"
33+
className="px-4 py-2 text-white bg-secondary hover:bg-secondary-darker"
3434
disabled={false}
3535
>
3636
Secondary
@@ -39,7 +39,7 @@ exports[`Button matches secondary type snapshot 1`] = `
3939

4040
exports[`Button matches with external className as object 1`] = `
4141
<button
42-
className="px-4 py-2 text-white bg-green-700 hover:bg-green-800 external-classname-true"
42+
className="px-4 py-2 text-white bg-primary hover:bg-primary-darker external-classname-true"
4343
disabled={false}
4444
>
4545
Hello
@@ -48,7 +48,7 @@ exports[`Button matches with external className as object 1`] = `
4848

4949
exports[`Button matches with external className as string 1`] = `
5050
<button
51-
className="px-4 py-2 text-white bg-green-700 hover:bg-green-800 external-classname"
51+
className="px-4 py-2 text-white bg-primary hover:bg-primary-darker external-classname"
5252
disabled={false}
5353
>
5454
Hello

src/components/__snapshots__/Dropdown.test.tsx.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`Dropdown matches snapshot 1`] = `
55
className="relative inline-block"
66
>
77
<button
8-
className="p-2 rounded-full hover:bg-green-700 hover:bg-opacity-25"
8+
className="p-2 rounded-full hover:bg-primary hover:bg-opacity-25"
99
onClick={[Function]}
1010
>
1111
menu

src/pages/index.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,18 @@ const IndexPage: NextPage = () => {
1919
</p>
2020
<div className="space-x-4">
2121
<Link {...routes.COMPONENTS}>
22-
<a className="bg-green-700 text-white px-4 py-2" title="components">
22+
<a
23+
className="bg-primary hover:bg-primary-darker text-white px-4 py-2"
24+
title="components"
25+
>
2326
Components <FiArrowRight className="inline ml-1" />
2427
</a>
2528
</Link>
2629
<Link {...routes.TYPOGRAPHY}>
27-
<a className="bg-blue-700 text-white px-4 py-2" title="Typography">
30+
<a
31+
className="bg-secondary hover:bg-secondary-darker text-white px-4 py-2"
32+
title="Typography"
33+
>
2834
Typography <FiArrowRight className="inline ml-1" />
2935
</a>
3036
</Link>

src/styles/nprogress.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
}
44

55
#nprogress .bar {
6-
@apply bg-green-600;
6+
@apply bg-primary;
77
@apply fixed top-0 left-0;
88
@apply z-50;
99
@apply w-full h-1;

tailwind.config.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,20 @@ module.exports = {
1010
header: ['Open Sans', 'sans-serif'],
1111
body: ['Open Sans', 'sans-serif'],
1212
},
13-
extend: {},
13+
extend: {
14+
colors: {
15+
primary: {
16+
lighter: '#4FD1C5',
17+
default: '#38B2AC',
18+
darker: '#319795',
19+
},
20+
secondary: {
21+
lighter: '#63B3ED',
22+
default: '#4299E1',
23+
darker: '#3182CE',
24+
},
25+
},
26+
},
1427
},
1528
variants: {
1629
backgroundColor: ['dark', 'responsive', 'hover', 'focus'],

0 commit comments

Comments
 (0)