diff --git a/.storybook/main.js b/.storybook/main.js index 86e57839..df4a39ff 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -1,16 +1,20 @@ const webpack = require('webpack'); module.exports = { - stories: ['../src/**/*.stories.@(ts|tsx|js|jsx)', '../stories/**/*.stories.@(ts|tsx|js|jsx)'], + stories: [ + '../src/**/*.stories.@(ts|tsx|js|jsx)', + '../stories/**/*.stories.@(ts|tsx|js|jsx)', + ], addons: ['@storybook/addon-links', '@storybook/addon-essentials'], typescript: { - check: false, // type-check stories during Storybook build + check: false, + reactDocgen: false, }, - webpackFinal: async (config) => { + webpackFinal: async config => { // allow __DEV__ macro to be used config.plugins.push( new webpack.DefinePlugin({ - '__DEV__': process.env.NODE_ENV === 'development' + __DEV__: process.env.NODE_ENV === 'development', }) ); @@ -20,4 +24,4 @@ module.exports = { fastRefresh: true, strictMode: true, }, -} \ No newline at end of file +}; diff --git a/src/Checkbox/Checkbox.stories.tsx b/src/Checkbox/Checkbox.stories.tsx index 033a2f96..c351dfb8 100644 --- a/src/Checkbox/Checkbox.stories.tsx +++ b/src/Checkbox/Checkbox.stories.tsx @@ -21,16 +21,18 @@ export default meta; const Template: Story = args => { const [checked, setChecked] = React.useState(true); - return ( - setChecked(!checked)} - {...args} - /> - ); + const onCheckboxChange = () => setChecked(!checked); + + return ; }; export const Basic = Template.bind({}); Basic.args = { - children: 'Stay Logged In', + children: 'Option 1', +}; + +export const Disabled = Template.bind({}); +Disabled.args = { + children: 'Option 1', + disabled: true, }; diff --git a/src/Checkbox/index.tsx b/src/Checkbox/index.tsx index 5ff0eacf..e3027ec6 100644 --- a/src/Checkbox/index.tsx +++ b/src/Checkbox/index.tsx @@ -1,9 +1,16 @@ import React, { forwardRef } from 'react'; +import styled from 'styled-components'; import { CustomCheckboxContainer, CustomCheckboxInput } from '@reach/checkbox'; + import { MinervaProps, Box } from '../layout'; import PseudoBox from '../PseudoBox'; import { useComponentStyles } from '../theme'; +export const StyledBox = styled(Box)` + font-weight: 400; + font-size: 14px; +`; + type BaseProps = MinervaProps & React.InputHTMLAttributes; export interface CustomCheckboxProps { @@ -28,7 +35,7 @@ export const Checkbox = forwardRef(function Checkbox( const componentStyles = useComponentStyles('Checkbox'); return ( ); }); diff --git a/src/theme.ts b/src/theme.ts index f803e613..528eec83 100644 --- a/src/theme.ts +++ b/src/theme.ts @@ -69,7 +69,44 @@ const defaultTheme: MinervaTheme = { borderStyle: 'solid', borderColor: '#d2d6dc', }, - Checkbox: {}, + Checkbox: { + width: '15px', + height: '15px', + marginRight: '8px', + borderRadius: '3px', + borderWidth: '1.5px', + borderColor: '#000', + borderStyle: 'solid', + padding: '2px', + appearance: 'none', + transition: + 'background-color, border-color 150ms cubic-bezier(0.4, 0, 0.2, 1)', + backgroundColor: '#fff', + _active: { + borderColor: '#000', + }, + _checked: { + backgroundColor: '#000', + }, + _focus: { + boxShadow: '0 0 0 1.5px #651FFF', + }, + _disabled: { + '&[aria-checked=true]': { + backgroundColor: '#BDBDBD', + }, + '&[aria-checked=false]': { + backgroundColor: '#transparent', + borderColor: '#000', + }, + borderColor: '#BDBDBD', + cursor: 'not-allowed', + backgroundImage: 'none', + }, + _hover: { + backgroundColor: 'transparent', + }, + }, Drawer: {}, Heading: { fontWeight: 'bold' }, Image: {},