File tree Expand file tree Collapse file tree 3 files changed +50
-5
lines changed Expand file tree Collapse file tree 3 files changed +50
-5
lines changed Original file line number Diff line number Diff line change @@ -3,13 +3,31 @@ import { ReactNode } from 'react'
3
3
type ButtonProps = {
4
4
children : ReactNode
5
5
onClick ?: ( ) => void
6
+ color ?: 'primary' | 'secondary' | 'transparent'
7
+ variant ?: 'contained' | 'outlined' | 'text'
6
8
}
7
9
8
- const Button = ( { children, onClick : onClick } : ButtonProps ) => {
10
+ const Button = ( {
11
+ children,
12
+ onClick : onClick ,
13
+ color = 'primary' ,
14
+ variant = 'contained' ,
15
+ } : ButtonProps ) => {
16
+ const getColorStyles = ( color : string ) => {
17
+ if ( color === 'primary' ) {
18
+ return 'text-white bg-blue-700 hover:bg-blue-800 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800'
19
+ }
20
+ if ( color === 'transparent' ) {
21
+ return 'focus:ring-transparent'
22
+ }
23
+ return ''
24
+ }
9
25
return (
10
26
< button
11
27
type = "button"
12
- className = "text-white font-bold bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 rounded-lg text-sm px-5 py-2.5 text-center mr-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
28
+ className = { ` focus:ring-4 rounded-lg text-sm px-5 py-2.5 text-center mr-2 mb-2 ${ getColorStyles (
29
+ color
30
+ ) } `}
13
31
onClick = { onClick }
14
32
>
15
33
{ children }
Original file line number Diff line number Diff line change 1
1
import { graphql , usePaginationFragment } from 'react-relay'
2
- import { Comments_story$key } from '../../queries/__generated__/Comments_story.graphql'
3
2
import NewComment from './NewComment'
4
3
import Comment from './Comment'
5
4
6
5
type CommentsProps = {
7
- story : Comments_story$key
6
+ story : any
8
7
}
9
8
10
9
const Comments = ( { story } : CommentsProps ) => {
Original file line number Diff line number Diff line change @@ -21,5 +21,33 @@ export default function ThemeButton() {
21
21
setDarkMode ( ! darkMode )
22
22
}
23
23
24
- return < Button onClick = { onClick } > toggle dark mode</ Button >
24
+ return (
25
+ < Button onClick = { onClick } color = "transparent" >
26
+ { darkMode ? (
27
+ < svg
28
+ id = "day"
29
+ xmlns = "http://www.w3.org/2000/svg"
30
+ width = "24"
31
+ height = "24"
32
+ style = { { fill : '#fff' } }
33
+ >
34
+ < path d = "M18.1 5.1c0 .3-.1.6-.3.9l-1.4 1.4-.9-.8 2.2-2.2c.3.1.4.4.4.7zm-.5 5.3h3.2c0 .3-.1.6-.4.9s-.5.4-.8.4h-2v-1.3zm-6.2-5V2.2c.3 0 .6.1.9.4s.4.5.4.8v2h-1.3zm6.4 11.7c-.3 0-.6-.1-.8-.3l-1.4-1.4.8-.8 2.2 2.2c-.2.2-.5.3-.8.3zM6.2 4.9c.3 0 .6.1.8.3l1.4 1.4-.8.9-2.2-2.3c.2-.2.5-.3.8-.3zm5.2 11.7h1.2v3.2c-.3 0-.6-.1-.9-.4s-.4-.5-.4-.8l.1-2zm-7-6.2h2v1.2H3.2c0-.3.1-.6.4-.9s.5-.3.8-.3zM6.2 16l1.4-1.4.8.8-2.2 2.2c-.2-.2-.3-.5-.3-.8s.1-.6.3-.8z" />
35
+ < circle cx = "12" cy = "11" r = "4" />
36
+ </ svg >
37
+ ) : (
38
+ < svg
39
+ id = "night"
40
+ xmlns = "http://www.w3.org/2000/svg"
41
+ width = "24"
42
+ height = "24"
43
+ viewBox = "0 0 24 24"
44
+ >
45
+ < path
46
+ d = "M19.1 17.5c-3.3 1.4-7.1-.2-8.5-3.5-1.4-3.3.2-7.1 3.5-8.5.2-.1.5-.2.7-.3-1.6-.4-3.2-.3-4.8.4C6 7.3 4 12 5.7 16c1.7 4.1 6.4 6 10.5 4.3 1.7-.7 3-1.9 3.8-3.4-.3.3-.6.4-.9.6z"
47
+ fill = "#444;"
48
+ />
49
+ </ svg >
50
+ ) }
51
+ </ Button >
52
+ )
25
53
}
You can’t perform that action at this time.
0 commit comments