Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: swap default expand icon for collapse component #491

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading