-
Notifications
You must be signed in to change notification settings - Fork 751
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
9e89a7a
commit bb4c67e
Showing
3 changed files
with
64 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from "react"; | ||
import Checkbox from "./index"; | ||
|
||
export default { | ||
title: "Checkbox", | ||
component: Checkbox, | ||
argTypes: {}, | ||
}; | ||
|
||
export const Default: React.FC = () => { | ||
return ( | ||
<div> | ||
<Checkbox /> | ||
</div> | ||
); | ||
}; |
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,47 @@ | ||
import styled from "styled-components"; | ||
|
||
const Checkbox = styled.input.attrs({ type: "checkbox" })` | ||
appearance: none; | ||
overflow: hidden; | ||
cursor: pointer; | ||
position: relative; | ||
display: inline-block; | ||
height: 32px; | ||
width: 32px; | ||
vertical-align: middle; | ||
transition: background-color 0.2s ease-in-out; | ||
border: 0; | ||
border-radius: 8px; | ||
background-color: ${({ theme }) => theme.colors.input}; | ||
&:after { | ||
content: ""; | ||
position: absolute; | ||
border-bottom: 2px solid; | ||
border-left: 2px solid; | ||
border-color: transparent; | ||
top: 30%; | ||
left: 0; | ||
right: 0; | ||
width: 50%; | ||
height: 25%; | ||
margin: auto; | ||
transform: rotate(-50deg); | ||
transition: border-color 0.2s ease-in-out; | ||
} | ||
&:focus { | ||
outline: none; | ||
} | ||
&:disabled { | ||
cursor: default; | ||
opacity: 0.6; | ||
} | ||
&:checked { | ||
background-color: ${({ theme }) => theme.colors.success}; | ||
&:after { | ||
border-color: white; | ||
} | ||
} | ||
`; | ||
|
||
export default Checkbox; |
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