Skip to content

Commit

Permalink
rewrite some styled components to ve
Browse files Browse the repository at this point in the history
  • Loading branch information
talentlessguy committed Aug 7, 2024
1 parent 5c8a2a1 commit 430178b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
11 changes: 4 additions & 7 deletions components/src/components/molecules/Dropdown/ActionSheet.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react'

import { Colors, breakpoints } from '@/src/tokens'
import { breakpoints } from '@/src/tokens'

import { actionSheeItem } from './styles.css'

Expand Down Expand Up @@ -50,11 +50,8 @@ const ActionSheetItem = (props: BoxProps) => (
/>
)

const ActionSheetLinkItem = styled.a<{ $color?: Colors }>(
({ theme, $color = 'text' }) => css`
color: ${theme.colors[$color]};
font-weight: ${theme.fontWeights.normal};
`,
const ActionSheetLinkItem = (props: BoxProps) => (
<Box {...props} color={props.color || '$text'} fontWeight="$normal" />
)

type Props = {
Expand Down Expand Up @@ -100,7 +97,7 @@ export const ActionSheet = React.forwardRef<HTMLDivElement, Props>(
>
{icon}
{href ? (
<ActionSheetLinkItem $color={color} href={href}>
<ActionSheetLinkItem color={color} href={href}>
{label}
</ActionSheetLinkItem>
) : (
Expand Down
4 changes: 3 additions & 1 deletion components/src/components/molecules/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { Colors, breakpoints } from '@/src/tokens'

import { commonVars, modeVars } from '@/src/css/theme.css'

import { Color } from '@/src/interfaces/withColor'

import { DownChevronSVG, DynamicPopover, ScrollBox } from '../..'
import { ActionSheet } from './ActionSheet'
import { Box, BoxProps } from '../../atoms/Box/Box'
Expand All @@ -24,7 +26,7 @@ export type DropdownItemObject = {
wrapper?: (children: React.ReactNode, key: React.Key) => JSX.Element
icon?: React.ReactNode
value?: string
color?: Colors
color?: Color
disabled?: boolean
showIndicator?: boolean | Colors
href?: string
Expand Down
27 changes: 16 additions & 11 deletions components/src/components/organisms/Dialog/DialogContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Space } from '@/src/tokens'

import { mq } from '@/src/utils/responsiveHelpers'

import { ScrollBox } from '../..'
import { Box, BoxProps, ScrollBox } from '../..'

type NativeFromProps = React.FormHTMLAttributes<HTMLFormElement>

Expand Down Expand Up @@ -75,15 +75,20 @@ const Container = styled.div<{
`,
)

const ScrollBoxContent = styled.div<{ $gap: Space }>(
({ theme, $gap }) => css`
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
width: ${theme.space.full};
gap: ${theme.space[$gap]};
`,
const ScrollBoxContent = ({
gap,
children,
}: Pick<BoxProps, 'gap' | 'children'>) => (
<Box
alignItems="center"
display="flex"
flexDirection="column"
gap={gap}
justifyContent="flex-start"
width="$full"
>
{children}
</Box>
)

export const DialogContent = React.forwardRef<
Expand Down Expand Up @@ -114,7 +119,7 @@ export const DialogContent = React.forwardRef<
{...{ target, method, action, onSubmit }}
>
<ScrollBox {...props} horizontalPadding={horizontalPadding}>
<ScrollBoxContent $gap={gap}>{children}</ScrollBoxContent>
<ScrollBoxContent gap={gap}>{children}</ScrollBoxContent>
</ScrollBox>
</Container>
)
Expand Down

0 comments on commit 430178b

Please sign in to comment.