Skip to content

Commit 39ad9b9

Browse files
💄 style: Update SumbitFooter
1 parent 4404a1c commit 39ad9b9

File tree

4 files changed

+29
-15
lines changed

4 files changed

+29
-15
lines changed

src/ColorSwatches/demos/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default () => {
1212
enableColorSwatches: true,
1313
gap: {
1414
step: 1,
15-
value: 4,
15+
value: 6,
1616
},
1717
shape: {
1818
options: ['circle', 'square'],
@@ -33,7 +33,7 @@ export default () => {
3333
<ColorSwatches
3434
colors={[
3535
{
36-
color: '',
36+
color: 'rgba(0, 0, 0, 0)',
3737
label: 'Default',
3838
},
3939
{

src/ColorSwatches/index.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client';
22

33
import { ColorPicker } from 'antd';
4+
import chroma from 'chroma-js';
45
import { CheckIcon } from 'lucide-react';
56
import { readableColor, rgba } from 'polished';
67
import { memo } from 'react';
@@ -57,18 +58,23 @@ const ColorSwatches = memo<ColorSwatchesProps>(
5758
active && active !== theme.colorPrimary && !colors.some((c) => c.color === active);
5859

5960
return (
60-
<Flexbox gap={4} horizontal style={{ flexWrap: 'wrap', ...style }} {...rest}>
61+
<Flexbox gap={6} horizontal style={{ flexWrap: 'wrap', ...style }} {...rest}>
6162
{enableColorSwatches &&
6263
colors.map((c) => {
6364
const color = c.color || theme.colorPrimary;
6465
const isActive = (!active && !c.color) || color === active;
66+
const isTransparent = c.color === 'transparent' || chroma(c.color).alpha() === 0;
6567
return (
6668
<Tooltip key={c.label} title={c.label}>
6769
<Center
68-
className={cx(styles.container, isActive && styles.active)}
70+
className={cx(
71+
styles.container,
72+
isTransparent && styles.transparent,
73+
isActive && styles.active,
74+
)}
6975
onClick={() => setActive(c.color || undefined)}
7076
style={{
71-
background: color,
77+
background: isTransparent ? undefined : color,
7278
borderRadius: shape === 'circle' ? '50%' : theme.borderRadius,
7379
}}
7480
>

src/ColorSwatches/style.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createStyles } from 'antd-style';
33
export const useStyles = createStyles(({ css, token, prefixCls }, size: number) => {
44
return {
55
active: css`
6-
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 20%);
6+
box-shadow: inset 0 0 0 1px ${token.colorFill};
77
`,
88
conic: css`
99
background: conic-gradient(
@@ -37,7 +37,7 @@ export const useStyles = createStyles(({ css, token, prefixCls }, size: number)
3737
min-height: ${size}px;
3838
3939
background: ${token.colorBgContainer};
40-
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 5%);
40+
box-shadow: inset 0 0 0 1px ${token.colorFillSecondary};
4141
4242
&:hover {
4343
box-shadow:
@@ -57,11 +57,11 @@ export const useStyles = createStyles(({ css, token, prefixCls }, size: number)
5757
padding: 0;
5858
5959
border: none;
60-
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 5%);
60+
box-shadow: inset 0 0 0 1px ${token.colorFillSecondary};
6161
6262
&:hover {
6363
box-shadow:
64-
inset 0 0 0 1px rgba(0, 0, 0, 5%),
64+
inset 0 0 0 1px ${token.colorFillSecondary},
6565
0 0 0 2px ${token.colorText};
6666
}
6767
@@ -72,5 +72,15 @@ export const useStyles = createStyles(({ css, token, prefixCls }, size: number)
7272
border-radius: inherit;
7373
}
7474
`,
75+
76+
transparent: css`
77+
background-image: conic-gradient(
78+
${token.colorFillSecondary} 25%,
79+
transparent 25% 50%,
80+
${token.colorFillSecondary} 50% 75%,
81+
transparent 75% 100%
82+
);
83+
background-size: 50% 50%;
84+
`,
7585
};
7686
});

src/Form/components/FormSubmitFooter.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ export interface FormSubmitFooterProps extends FlexboxProps {
4545
float?: boolean;
4646
onReset?: () => void;
4747
resetButtonProps?: Omit<ButtonProps, 'children'>;
48-
resetText?: ReactNode;
4948
saveButtonProps?: Omit<ButtonProps, 'children'>;
50-
saveText?: ReactNode;
5149
texts?: {
50+
reset?: string;
51+
submit?: string;
5252
unSaved?: string;
5353
unSavedWarning?: string;
5454
};
@@ -59,8 +59,6 @@ const FormSubmitFooter = memo<FormSubmitFooterProps>(
5959
enableReset = true,
6060
buttonProps,
6161
float,
62-
saveText = 'Submit',
63-
resetText = 'Reset',
6462
onReset,
6563
saveButtonProps,
6664
resetButtonProps,
@@ -135,7 +133,7 @@ const FormSubmitFooter = memo<FormSubmitFooterProps>(
135133
{...buttonProps}
136134
{...resetButtonProps}
137135
>
138-
{resetText}
136+
{texts?.reset || 'Reset'}
139137
</Button>
140138
)}
141139
<Button
@@ -146,7 +144,7 @@ const FormSubmitFooter = memo<FormSubmitFooterProps>(
146144
{...buttonProps}
147145
{...saveButtonProps}
148146
>
149-
{saveText}
147+
{texts?.submit || 'Submit'}
150148
</Button>
151149
</>
152150
);

0 commit comments

Comments
 (0)