Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
majakomel committed May 28, 2024
1 parent a1fe736 commit 7acd561
Show file tree
Hide file tree
Showing 12 changed files with 130 additions and 200 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@storybook/react-vite": "^8.0.9",
"@storybook/test": "^8.0.9",
"@svgr/rollup": "^8.1.0",
"@tailwindcss/forms": "^0.5.7",
"@testing-library/dom": "^9.3.4",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.1",
Expand Down
34 changes: 0 additions & 34 deletions src/__test__/Container.test.tsx

This file was deleted.

138 changes: 85 additions & 53 deletions src/components/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,61 +25,93 @@ const Checkbox = forwardRef(
}: CheckboxProps,
ref,
) => (
<Flex
sx={{
...(reverse && {
flexDirection: 'row-reverse',
justifyContent: 'flex-end',
}),
gap: 2,
}}
{...getMarginProps(props)}
>
<Box
as="input"
ref={ref}
type="checkbox"
id={name}
{...omitMarginProps(props)}
__css={{
flexShrink: 0,
flexGrow: 0,
color: 'blue5',
appearance: 'none',
margin: 0,
font: 'inherit',
width: '1.25em',
height: '1.25em',
border: '0.07em solid gray',
display: 'grid',
placeContent: 'center',
'&::before': {
backgroundColor: 'currentColor',
content: '""',
width: '0.75em',
height: '0.75em',
transform: 'scale(0)',
transition: '120ms transform ease-in-out',
},
'&:checked::before': {
transform: 'scale(1)',
},
'&:focus': {
outline: 'max(1px, 0.02em) solid currentColor',
outlineOffset: 'max(1px, 0.15em)',
},
}}
/>
<Box
as="label"
htmlFor={name}
css={{
overflowWrap: 'anywhere',
<>
<div className="relative flex items-start">
<div className="flex items-center h-5">
<input
// ref={ref}
id={name}
aria-describedby="comments-description"
name="comments"
type="checkbox"
className="
checked:bg-none
checked:bg-transparent
w-5
h-5
checked:border-black
before:content-['']
before:bg-current
before:w-3
before:h-3
before:scale-1
before:transition-transform
checked:before:scale-1
"
/>
</div>
<div className="ml-3 text-sm">
<label htmlFor={name} className="font-medium text-gray-700">
{label}
</label>
</div>
</div>
<Flex
sx={{
...(reverse && {
flexDirection: 'row-reverse',
justifyContent: 'flex-end',
}),
gap: 2,
}}
{...getMarginProps(props)}
>
{label}
</Box>
</Flex>
<Box
as="input"
ref={ref}
type="checkbox"
id={name}
{...omitMarginProps(props)}
__css={{
// flexShrink: 0,
// flexGrow: 0,
// color: 'blue5',
appearance: 'none',
margin: 0,
font: 'inherit',
width: '1.25em',
height: '1.25em',
border: '0.07em solid gray',
display: 'grid',
placeContent: 'center',
'&::before': {
backgroundColor: 'currentColor',
content: '""',
width: '0.75em',
height: '0.75em',
transform: 'scale(0)',
transition: '120ms transform ease-in-out',
},
'&:checked::before': {
transform: 'scale(1)',
},
'&:focus': {
outline: 'max(1px, 0.02em) solid currentColor',
outlineOffset: 'max(1px, 0.15em)',
},
}}
/>
<Box
as="label"
htmlFor={name}
css={{
overflowWrap: 'anywhere',
}}
>
{label}
</Box>
</Flex>
</>
),
)

Expand Down
7 changes: 0 additions & 7 deletions src/components/Container.tsx

This file was deleted.

36 changes: 18 additions & 18 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
export { default as colors } from './theme/colors'
export { default as theme } from './theme'
export { default as Box } from './components/Box'
export { default as Button } from './components/Button'
export { default as Checkbox } from './components/Checkbox'
export { default as FacebookShareButton } from './components/FacebookShareButton'
export { default as Flex } from './components/Flex'
export { default as Container } from './components/Container'
export { default as Heading } from './components/Heading'
export { default as Hero } from './components/Hero'
export { default as HeroLead } from './components/HeroLead'
export { default as IconButton } from './components/IconButton'
export { default as Image } from './components/Image'
export { default as Input } from './components/Input'
export { default as RadioButton } from './components/RadioButton'
export { default as RadioGroup } from './components/RadioGroup'
export { default as FacebookShareButton } from './components/FacebookShareButton'
export { default as TwitterShareButton } from './components/TwitterShareButton'
export { default as Text } from './components/Text'
export { default as InputWithIconButton } from './components/InputWithIconButton'
export { default as Label } from './components/Label'
export { default as Link } from './components/Link'
export { default as LogoOONIRun } from './components/LogoOONIRun'
export { default as Hero } from './components/Hero'
export { default as HeroLead } from './components/HeroLead'
export { default as Modal } from './components/Modal'
export { default as Button } from './components/Button'
export { default as Textarea } from './components/Textarea'
export { default as Link } from './components/Link'
export { default as Image } from './components/Image'
export { default as Select } from './components/Select'
export { default as Checkbox } from './components/Checkbox'
export { default as Label } from './components/Label'
export { default as MultiSelectCreatable } from './components/MultiSelectCreatable'
export { default as MultiSelect } from './components/MultiSelect'
export { default as MultiSelectCreatable } from './components/MultiSelectCreatable'
export { default as RadioButton } from './components/RadioButton'
export { default as RadioGroup } from './components/RadioGroup'
export { default as Select } from './components/Select'
export { default as Text } from './components/Text'
export { default as Textarea } from './components/Textarea'
export { default as TwitterShareButton } from './components/TwitterShareButton'
export { default as theme } from './theme'
export { default as colors } from './theme/colors'

37 changes: 0 additions & 37 deletions stories/Box.stories.tsx

This file was deleted.

28 changes: 0 additions & 28 deletions stories/Container.stories.tsx

This file was deleted.

15 changes: 6 additions & 9 deletions stories/InputWithIconButton.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { action } from '@storybook/addon-actions'
import { Meta, StoryObj } from '@storybook/react'
import React from 'react'
import { MdDelete } from 'react-icons/md'
import Container from '../src/components/Container'
import InputWithIconButton from '../src/components/InputWithIconButton'

const meta: Meta = {
Expand All @@ -16,14 +15,12 @@ type Story = StoryObj<typeof meta>

export const Default: Story = {
render: (args) => (
<Container>
<InputWithIconButton
{...args}
icon={<MdDelete size={30} />}
placeholder="https://twitter.com/"
onAction={action('icon clicked')}
/>
</Container>
<InputWithIconButton
{...args}
icon={<MdDelete size={30} />}
placeholder="https://twitter.com/"
onAction={action('icon clicked')}
/>
),
}

Expand Down
7 changes: 1 addition & 6 deletions stories/LogoOONIRun.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Meta } from '@storybook/react'
import React from 'react'
import Container from '../src/components/Container'
import LogoOONIRun from '../src/components/LogoOONIRun'

const meta: Meta = {
Expand All @@ -11,9 +10,5 @@ const meta: Meta = {
export default meta

export const Default = () => {
return (
<Container bg="blue4">
<LogoOONIRun height="70px" />
</Container>
)
return <LogoOONIRun height="70px" />
}
5 changes: 2 additions & 3 deletions stories/Modal.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Meta, StoryObj } from '@storybook/react'
import React, { useCallback, useState } from 'react'
import Box from '../src/components/Box'
import Button from '../src/components/Button'
import Container from '../src/components/Container'
import Flex from '../src/components/Flex'
import Modal from '../src/components/Modal'

Expand All @@ -26,13 +25,13 @@ export const Default = () => {
}, [])

return (
<Container>
<>
<Flex alignItems="center">
<Button onClick={() => setShow(true)}> Show Modal </Button>
</Flex>
<Modal show={show} onHideClick={onClose}>
<Box p={3}>Modal Content</Box>
</Modal>
</Container>
</>
)
}
10 changes: 5 additions & 5 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ module.exports = {
},
},

// plugins: [
// require('@tailwindcss/typography'),
// require('@tailwindcss/aspect-ratio'),
// require('@tailwindcss/forms'),
// ],
plugins: [
// require('@tailwindcss/typography'),
// require('@tailwindcss/aspect-ratio'),
require('@tailwindcss/forms')({ strategy: 'base' }),
],
}
Loading

0 comments on commit 7acd561

Please sign in to comment.