-
-
Notifications
You must be signed in to change notification settings - Fork 242
Expand file tree
/
Copy pathButton.tsx
More file actions
30 lines (27 loc) · 659 Bytes
/
Button.tsx
File metadata and controls
30 lines (27 loc) · 659 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { css } from '@emotion/react'
import styled from '@emotion/styled'
import { useState } from 'react'
// Ensure HMR of styled component alongside other components
export const StyledCode = styled.code`
color: #646cff;
`
export const Button = ({ color }: { color: string }) => {
const [count, setCount] = useState(0)
return (
<button
css={css`
padding: 10px 16px;
background-color: #d26ac2;
font-size: 20px;
border-radius: 4px;
border: 0px;
&:hover {
color: ${color};
}
`}
onClick={() => setCount(count + 1)}
>
count is {count}
</button>
)
}