Skip to content

Commit fedf03e

Browse files
authored
Merge pull request #320 from dd3tech/fix/file-item-button
Fix: change file item button layout
2 parents 628ac48 + 0590cd4 commit fedf03e

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

src/components/AsideModalV2/AsideModalV2.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export interface AsideModalProps extends ComponentProps<'aside'> {
5656
buttons?: ModalButton[]
5757
search?: FilterSearchProps
5858
tabs?: ModalTabs
59+
hideDivider?: boolean
5960
tagTitle?: {
6061
variant: 'primary' | 'secondary' | 'success' | 'warning'
6162
text: string
@@ -71,6 +72,7 @@ const AsideModalV2: FC<AsideModalProps> = ({
7172
disableEscapeKeyDown,
7273
isStickyTitle,
7374
description,
75+
hideDivider = false,
7476
buttons,
7577
children,
7678
search,
@@ -98,7 +100,7 @@ const AsideModalV2: FC<AsideModalProps> = ({
98100

99101
const renderHeaderContent = () => (
100102
<>
101-
<Divider light className="mt-1 bg-gray-50" />
103+
{!hideDivider && <Divider light className="mt-1 bg-gray-50" />}
102104
<Flex gap="4" className="flex-col">
103105
<Flex gap="2" alignItems="center" justifyContent="between">
104106
{description && (
@@ -229,7 +231,8 @@ const AsideModalV2: FC<AsideModalProps> = ({
229231
<Flex
230232
gap="4"
231233
className={composeClasses(
232-
'bg-gray-50 px-10 pt-6 pb-4 flex-col',
234+
'bg-gray-50 px-10 pt-6 flex-col',
235+
!hideDivider && 'pb-4',
233236
isStickyTitle && 'sticky top-0 z-50'
234237
)}
235238
>

src/components/Form/File/FileItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const FileItem = ({
9393
</Flex>
9494
<div
9595
role="file-actions"
96-
className="grid items-center gap-3"
96+
className="grid items-center gap-2"
9797
style={{
9898
gridAutoFlow: 'column',
9999
gridTemplateColumns: 'repeat(auto-fit, auto)'

src/components/Form/File/FileItemButton.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ describe('<FileItemButton>', () => {
1515
render(<FileItemButton onClick={handleClick}>Click Me</FileItemButton>)
1616

1717
fireEvent.click(screen.getByText('Click Me'))
18+
1819
expect(handleClick).toHaveBeenCalledTimes(1)
1920
})
2021

@@ -24,7 +25,7 @@ describe('<FileItemButton>', () => {
2425
)
2526

2627
const buttonElement = getByRole('button-file-item').closest('button')
27-
expect(buttonElement).toHaveClass('border-gray-500')
28+
2829
expect(buttonElement).toHaveClass('text-red-500')
2930
})
3031
})

src/components/Form/File/FileItemButton.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,16 @@ export interface FileItemButtonProps extends Omit<IButtonProps, 'children'> {
3030
}
3131

3232
const BUTTON_VARIANTS = {
33-
primary:
34-
'border-gray-500 text-gray-500 hover:border-blue-500 hover:text-white hover:bg-blue-500',
35-
secondary:
36-
'border-gray-500 text-red-500 hover:border-red-500 hover:text-white hover:bg-red-500'
33+
primary: 'text-gray-500 hover:text-blue-500',
34+
secondary: 'text-red-500 hover:text-red-400'
3735
}
3836

3937
const FileItemButton = ({
4038
children,
4139
className,
4240
onClick,
4341
isLoading,
44-
variant = 'secondary',
42+
variant = 'ghost',
4543
isDanger,
4644
...props
4745
}: FileItemButtonProps) => {
@@ -50,7 +48,7 @@ const FileItemButton = ({
5048
{...props}
5149
role="button-file-item"
5250
className={composeClasses(
53-
'w-4 h-4 rounded-full flex items-center justify-center flex-shrink-0 transition-all duration-300 ease-linear',
51+
'w-5 h-5 rounded-full flex items-center justify-center flex-shrink-0 transition-all duration-300 ease-linear',
5452
BUTTON_VARIANTS[isDanger ? 'secondary' : 'primary'],
5553
className
5654
)}

src/stories/AsideModalV2.stories.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ export const Basic = Template.bind({})
5959
Basic.args = {
6060
title: 'Basic Aside Modal',
6161
children: 'This is the basic content of the modal',
62-
description: sampleDescription
62+
description: sampleDescription,
63+
hideDivider: false
6364
}
6465

6566
export const WithButtons = Template.bind({})

0 commit comments

Comments
 (0)