mirror of
https://github.com/nocobase/nocobase
synced 2024-11-14 16:43:01 +00:00
style: optimize expand/collapse button styles (#5431)
Some checks are pending
Build docker image / build-and-push (push) Waiting to run
Build pro image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase frontEnd test / frontend-test (18) (push) Waiting to run
Some checks are pending
Build docker image / build-and-push (push) Waiting to run
Build pro image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase frontEnd test / frontend-test (18) (push) Waiting to run
This commit is contained in:
parent
96c3bf1a08
commit
52ad416140
@ -52,7 +52,7 @@ const useStyles = genStyleHook('nb-action', (token) => {
|
||||
marginInlineEnd: '0px !important',
|
||||
},
|
||||
'.nb-action-title': {
|
||||
marginInlineStart: '8px',
|
||||
marginInlineStart: `${token.controlPaddingHorizontalSM} px`,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
import { css } from '@emotion/css';
|
||||
import { useFieldSchema } from '@formily/react';
|
||||
import { Button } from 'antd';
|
||||
import { Button, theme } from 'antd';
|
||||
import React, { forwardRef, createRef } from 'react';
|
||||
import { composeRef } from 'rc-util/lib/ref';
|
||||
import { useCompile } from '../../hooks';
|
||||
@ -66,6 +66,9 @@ const InternalExpandAction = (props, ref) => {
|
||||
const compile = useCompile();
|
||||
const internalRef = createRef<HTMLButtonElement | HTMLAnchorElement>();
|
||||
const buttonRef = composeRef(ref, internalRef);
|
||||
const { token } = theme.useToken();
|
||||
const actionTitle = ctx?.expandFlag ? compile(titleCollapse) : compile(titleExpand);
|
||||
const icon = ctx?.expandFlag ? iconCollapse : iconExpand;
|
||||
return (
|
||||
//@ts-ignore
|
||||
<div className={actionDesignerCss} ref={buttonRef as React.Ref<HTMLButtonElement>}>
|
||||
@ -77,9 +80,27 @@ const InternalExpandAction = (props, ref) => {
|
||||
icon={<Icon type={ctx?.expandFlag ? iconCollapse : iconExpand} />}
|
||||
type={props.type}
|
||||
style={props?.style}
|
||||
className={css`
|
||||
.ant-btn-icon {
|
||||
margin-inline-end: 0px !important;
|
||||
}
|
||||
`}
|
||||
>
|
||||
{props.children?.[1]}
|
||||
<span style={{ marginLeft: 10 }}>{ctx?.expandFlag ? compile(titleCollapse) : compile(titleExpand)}</span>
|
||||
|
||||
{actionTitle && (
|
||||
<span
|
||||
className={
|
||||
icon
|
||||
? css`
|
||||
margin-inline-start: ${token.controlPaddingHorizontalSM}px;
|
||||
`
|
||||
: null
|
||||
}
|
||||
>
|
||||
{actionTitle}
|
||||
</span>
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user