Skip to content

Commit

Permalink
chore: swap default expand icon for collapse component (#491)
Browse files Browse the repository at this point in the history
Co-authored-by: Gaby Zifferman <[email protected]>
  • Loading branch information
tibuurcio and gabyzif authored Dec 19, 2024
1 parent c0e3048 commit ad063f5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
8 changes: 1 addition & 7 deletions docs/UX Patterns/Table/Table.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import { tableColumns, tableData, type TableDataType } from './TableStoryUtils'
import { SelectWithRangePicker } from 'docs/Candidate Components/Directory/Date Range Filter/SelectWithRangePicker'
import { useState } from 'react'
import { ColorTextDescription } from 'src/styles/style'
import MinusSquareOutlined from '@ant-design/icons/MinusSquareOutlined'
import PlusSquareOutlined from '@ant-design/icons/PlusSquareOutlined'

const meta: Meta<typeof Table> = {
title: 'UX Patterns/Table/Table',
Expand Down Expand Up @@ -110,11 +108,7 @@ const CollapsibleSection = ({ ...item }: ICollapsibleFormSectionProps): React.JS
},
},
}}>
<Collapse
ghost
expandIcon={({ isActive }): React.JSX.Element => (isActive ? <MinusSquareOutlined /> : <PlusSquareOutlined />)}
items={[{ ...item, key: 'item' }]}
/>
<Collapse ghost items={[{ ...item, key: 'item' }]} />
</ConfigProvider>
)
}
Expand Down
5 changes: 2 additions & 3 deletions src/components/data-display/Collapse/Collapse.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type Meta, type StoryObj } from '@storybook/react'
import type { Meta, StoryObj } from '@storybook/react'
import { Collapse } from 'src/components/data-display/Collapse/Collapse'
import { ExampleStory } from 'src/utils/ExampleStory'
import { type ICollapseProps } from 'src/components/data-display/Collapse/Collapse'
import type { ICollapseProps } from 'src/components/data-display/Collapse/Collapse'
import { Divider, Icon, Space } from 'src/components'
import { theme } from 'antd'
import { Select } from 'src/components'
Expand Down Expand Up @@ -42,7 +42,6 @@ const meta: Meta<typeof Collapse> = {
collapsible: undefined,
defaultActiveKey: undefined,
destroyInactivePanel: false,
expandIcon: undefined,
expandIconPosition: undefined,
ghost: false,
size: 'middle',
Expand Down
9 changes: 7 additions & 2 deletions src/components/data-display/Collapse/Collapse.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { Collapse as AntCollapse } from 'antd'
import type { CollapseProps as AntCollapseProps } from 'antd'
import { ConfigProvider } from 'src/components'
import { ConfigProvider, Icon } from 'src/components'

export interface ICollapseProps extends AntCollapseProps {}

export const Collapse = (props: ICollapseProps) => {
return (
<ConfigProvider>
<AntCollapse {...props} />
<AntCollapse
expandIcon={({ isActive }): React.JSX.Element =>
isActive ? <Icon name="dropdownOpen" size="sm" /> : <Icon name="next" size="sm" />
}
{...props}
/>
</ConfigProvider>
)
}
Expand Down

0 comments on commit ad063f5

Please sign in to comment.