Skip to content

Commit

Permalink
feat(Divider): change mode default to line and fix children issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Carrotzpc committed Jul 4, 2024
1 parent 8d60e5d commit 6afc272
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
14 changes: 6 additions & 8 deletions src/Divider/demos/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,19 @@ export default () => {

<div>
<Divider
content={
<div>
The YuntiUI components are inspired by LobeUI and developed based on Antd components,
fully compatible with Antd components, and it is recommended to use antd-style as the
default css-in-js styling solution.
</div>
}
content="YuntiUI"
dashed={true}
defaultOpen={true}
iconPlacement="left"
mode="expanded"
orientation="left"
orientationMargin={0}
>
YuntiUI
<div>
The YuntiUI components are inspired by LobeUI and developed based on Antd components,
fully compatible with Antd components, and it is recommended to use antd-style as the
default css-in-js styling solution.
</div>
</Divider>
</div>

Expand Down
16 changes: 12 additions & 4 deletions src/Divider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,16 @@ export interface CustomDividerProps {
export interface DividerProps extends AntdDividerProps, CustomDividerProps {}

export const Divider: React.FC<DividerProps> = props => {
const { mode, content, defaultOpen, iconPlacement, openIcon, closeIcon, type, ...otherProps } =
props;
const {
mode = 'line',
content,
defaultOpen,
iconPlacement = 'left',
openIcon,
closeIcon,
type,
...otherProps
} = props;

const { styles } = useStyles({});

Expand All @@ -64,12 +72,12 @@ export const Divider: React.FC<DividerProps> = props => {
>
<Space size={6}>
{iconPlacement !== 'right' && iconDom}
<span>{props.children}</span>
<span>{content}</span>
{iconPlacement === 'right' && iconDom}
</Space>
</span>
</AntdDivider>
{canExpanded && <div style={{ display: open ? 'block' : 'none' }}>{content}</div>}
{canExpanded && <div style={{ display: open ? 'block' : 'none' }}>{props.children}</div>}
</>
);
};
Expand Down

0 comments on commit 6afc272

Please sign in to comment.