-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef35ecf
commit 0e7d8c3
Showing
32 changed files
with
657 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import { Theme } from '@celo/react-celo'; | ||
|
||
interface Props { | ||
theme: Theme; | ||
currentTheme: Theme | null; | ||
onClick: (theme: Theme) => void; | ||
} | ||
|
||
export function ThemeButton({ theme, currentTheme, onClick }: Props) { | ||
const selected = currentTheme === theme; | ||
return ( | ||
<div | ||
className={`flex flex-row rounded gap-y-1 justify-between border cursor-pointer text-xs`} | ||
style={{ | ||
background: theme.background, | ||
borderWidth: selected ? 2 : 1, | ||
padding: selected ? 3 : 4, | ||
borderColor: selected ? theme.primary : theme.muted, | ||
}} | ||
onClick={() => onClick(theme)} | ||
> | ||
<div className="flex flex-col gap-y-2 w-full"> | ||
<div | ||
className="w-1/3 h-0.5 rounded" | ||
style={{ background: theme.text }} | ||
/> | ||
<div | ||
className="w-3/4 h-0.5 rounded" | ||
style={{ background: theme.text }} | ||
/> | ||
<div | ||
className="w-3/4 h-0.5 rounded" | ||
style={{ background: theme.textTertiary }} | ||
/> | ||
<div | ||
className="w-2/3 h-0.5 rounded" | ||
style={{ background: theme.muted }} | ||
/> | ||
</div> | ||
<div className="flex flex-row gap-x-2"> | ||
<div | ||
className="w-3 h-full rounded" | ||
style={{ background: theme.primary }} | ||
/> | ||
<div | ||
className="w-3 h-full rounded" | ||
style={{ background: theme.secondary }} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
const defaultDark = { | ||
primary: '#eef2ff', | ||
secondary: '#6366f1', | ||
text: '#ffffff', | ||
textSecondary: '#cbd5e1', | ||
textTertiary: '#64748b', | ||
muted: '#334155', | ||
background: '#1e293b', | ||
error: '#ef4444', | ||
}; | ||
const defaultLight = { | ||
primary: '#6366f1', | ||
secondary: '#eef2ff', | ||
text: '#000000', | ||
textSecondary: '#1f2937', | ||
textTertiary: '#64748b', | ||
muted: '#e2e8f0', | ||
background: '#ffffff', | ||
error: '#ef4444', | ||
}; | ||
const greenCustom = { | ||
primary: '#34d399', | ||
secondary: '#ecfccb', | ||
text: '#fff', | ||
textSecondary: '#d9f99d', | ||
textTertiary: '#bef264', | ||
muted: '#3f6212', | ||
background: '#000', | ||
error: '#ef4444', | ||
}; | ||
const roseCustom = { | ||
primary: '#e11d48', | ||
secondary: '#fda4af', | ||
text: '#fff', | ||
textSecondary: '#ffe4e6', | ||
textTertiary: '#fecdd3', | ||
muted: '#3f3f46', | ||
background: '#27272a', | ||
error: '#ef4444', | ||
}; | ||
|
||
export const themes = [defaultDark, defaultLight, greenCustom, roseCustom]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React from 'react'; | ||
|
||
import cls from '../utils/tailwind'; | ||
import useTheme from '../utils/useTheme'; | ||
|
||
const styles = cls({ | ||
button: ` | ||
tw-rounded | ||
tw-px-2 | ||
tw-py-1 | ||
tw-font-medium`, | ||
}); | ||
|
||
type anchorType = JSX.IntrinsicElements['a']; | ||
type buttonType = JSX.IntrinsicElements['button']; | ||
type extendType = anchorType & buttonType; | ||
|
||
interface Props extends extendType { | ||
as?: 'a' | 'button' | React.ComponentType<unknown>; | ||
className?: string; | ||
style?: Record<string, string | number>; | ||
} | ||
|
||
export default function Button({ | ||
as = 'button', | ||
className, | ||
style, | ||
...props | ||
}: Props) { | ||
const theme = useTheme(); | ||
|
||
const Component = as; | ||
|
||
return ( | ||
<Component | ||
className={`${styles.button} ${className || ''}`} | ||
style={{ | ||
color: theme.primary, | ||
background: theme.secondary, | ||
...style, | ||
}} | ||
{...props} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.