Skip to content

Commit 6c2bd59

Browse files
committed
fix: use tailwind
1 parent e151ce4 commit 6c2bd59

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

shell/app/common/components/edit-field.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,11 @@ export const EditField = React.forwardRef((props: IProps, _compRef) => {
281281
<div className={`common-edit-field ${className}`}>
282282
{label && (
283283
<div
284+
data-required="* "
284285
className={classnames(
285286
labelStyle === 'desc' ? 'color-text-sub' : 'color-text',
286287
'mb4',
287-
showRequiredMark ? 'ant-form-item-required' : '',
288+
showRequiredMark ? 'before:required' : '',
288289
)}
289290
style={{ paddingLeft: '10px' }}
290291
>

shell/app/styles/antd-extension.scss

+9-9
Original file line numberDiff line numberDiff line change
@@ -414,15 +414,15 @@ div.ant-table {
414414
}
415415
}
416416

417-
.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before {
418-
display: inline-block;
419-
margin-right: 4px;
420-
color: #ff4d4f;
421-
font-size: 14px;
422-
font-family: SimSun, sans-serif;
423-
line-height: 1;
424-
content: '*';
425-
}
417+
// .ant-form-item-required:not(.ant-form-item-required-mark-optional)::before {
418+
// display: inline-block;
419+
// margin-right: 4px;
420+
// color: #ff4d4f;
421+
// font-size: 14px;
422+
// font-family: SimSun, sans-serif;
423+
// line-height: 1;
424+
// content: '*';
425+
// }
426426

427427
// Leave the styles unchanged from nusi to antd4.x
428428
.ant-table-thead > tr > th,

shell/tailwind.config.js

+14
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ module.exports = {
106106
extend: {},
107107
},
108108
plugins: [
109+
plugin(({ addVariant, e }) => {
110+
addVariant('before', ({ modifySelectors, separator }) => {
111+
modifySelectors(({ className }) => {
112+
return `.${e(`before${separator}${className}`)}::before`;
113+
});
114+
});
115+
}),
109116
plugin(({ addUtilities }) => {
110117
const newUtilities = {
111118
'.nowrap': {
@@ -118,8 +125,15 @@ module.exports = {
118125
cursor: 'not-allowed',
119126
},
120127
};
128+
const contentUtilities = {
129+
'.required': {
130+
content: 'attr(data-required)',
131+
color: '#f5222d',
132+
},
133+
};
121134

122135
addUtilities(newUtilities, ['responsive', 'hover']);
136+
addUtilities(contentUtilities, ['before']);
123137
}),
124138
],
125139
purge: {

0 commit comments

Comments
 (0)