| 1 | import styled from "styled-components"; |
| 2 | import { defaultBorderRadius, vscBackground, vscForeground } from "."; |
| 3 | import { CheckIcon } from "@heroicons/react/24/outline"; |
| 4 | |
| 5 | interface CheckDivProps { |
| 6 | title: string; |
| 7 | checked: boolean; |
| 8 | onClick: () => void; |
| 9 | } |
| 10 | |
| 11 | const StyledDiv = styled.div<{ checked: boolean }>` |
| 12 | display: flex; |
| 13 | flex-direction: row; |
| 14 | align-items: center; |
| 15 | justify-content: center; |
| 16 | padding: 0.5rem; |
| 17 | border-radius: ${defaultBorderRadius}; |
| 18 | cursor: pointer; |
| 19 | border: 1px solid ${vscForeground}; |
| 20 | |
| 21 | color: ${vscForeground}; |
| 22 | background-color: ${vscBackground}; |
| 23 | |
| 24 | &:hover { |
| 25 | background-color: ${vscForeground}; |
| 26 | color: ${vscBackground}; |
| 27 | } |
| 28 | width: fit-content; |
| 29 | |
| 30 | margin: 0.5rem; |
| 31 | height: 1.4em; |
| 32 | |
| 33 | overflow: hidden; |
| 34 | text-overflow: ellipsis; |
| 35 | `; |
| 36 | |
| 37 | function CheckDiv(props: CheckDivProps) { |
| 38 | const { title, checked, onClick } = props; |
| 39 | |
| 40 | return ( |
| 41 | <StyledDiv onClick={onClick} checked={checked}> |
| 42 | {checked && <CheckIcon width="1.4em" height="1.4em" />} |
| 43 | {title} |
| 44 | </StyledDiv> |
| 45 | ); |
| 46 | } |
| 47 | |
| 48 | export default CheckDiv; |