Skip to content

Commit a7ecfea

Browse files
committed
fix(core): disable border thickness setting when no border is selected (#8152)
close AF-1351
1 parent 6b266e3 commit a7ecfea

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

packages/frontend/component/src/ui/slider/index.css.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ import { createVar, style } from '@vanilla-extract/css';
33

44
export const thumbSize = createVar();
55

6-
export const root = style({});
6+
export const root = style({
7+
selectors: {
8+
'&[data-disabled]': {
9+
opacity: 0.5,
10+
},
11+
},
12+
});
713

814
export const trackStyle = style({
915
width: '100%',
@@ -13,6 +19,11 @@ export const trackStyle = style({
1319
alignItems: 'center',
1420
padding: '12px 0',
1521
cursor: 'pointer',
22+
selectors: {
23+
'&[data-disabled]': {
24+
cursor: 'not-allowed',
25+
},
26+
},
1627
});
1728
export const fakeTrackStyle = style({
1829
width: `calc(100% - ${thumbSize})`,
@@ -42,6 +53,11 @@ export const thumbStyle = style({
4253
top: '50%',
4354
transform: 'translate(-50%, -50%)',
4455
cursor: 'pointer',
56+
selectors: {
57+
'&[data-disabled]': {
58+
cursor: 'not-allowed',
59+
},
60+
},
4561
});
4662

4763
export const nodeStyle = style({
@@ -58,5 +74,8 @@ export const nodeStyle = style({
5874
'&[data-active="true"]': {
5975
backgroundColor: cssVarV2('icon/primary'),
6076
},
77+
'&[data-disabled="true"]': {
78+
cursor: 'not-allowed',
79+
},
6180
},
6281
});

packages/frontend/component/src/ui/slider/slider.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export const Slider = ({
7171
thumbStyle,
7272
noteStyle,
7373
thumbSize = 14,
74+
disabled,
7475
...props
7576
}: SliderProps) => {
7677
const sliderRef = useRef<HTMLDivElement>(null);
@@ -93,6 +94,7 @@ export const Slider = ({
9394
style={rootStyle}
9495
className={styles.root}
9596
{...props}
97+
disabled={disabled}
9698
>
9799
<Sliders.Track className={styles.trackStyle} ref={sliderRef}>
98100
<div className={styles.fakeTrackStyle} style={trackStyle}>
@@ -108,6 +110,7 @@ export const Slider = ({
108110
key={index}
109111
className={styles.nodeStyle}
110112
data-active={value && value[0] >= nodeValue}
113+
data-disabled={disabled}
111114
style={{
112115
left: calcStepMarkOffset(
113116
index,

packages/frontend/core/src/components/affine/setting-modal/general-setting/editor/edgeless/note.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ export const NoteSettings = () => {
256256
max={12}
257257
step={2}
258258
nodes={[2, 4, 6, 8, 10, 12]}
259+
disabled={borderStyle === StrokeStyle.None}
259260
/>
260261
</SettingRow>
261262
</>

packages/frontend/core/src/components/affine/setting-modal/general-setting/editor/edgeless/shape.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ export const ShapeSettings = () => {
494494
max={12}
495495
step={2}
496496
nodes={[2, 4, 6, 8, 10, 12]}
497+
disabled={borderStyle === StrokeStyle.None}
497498
/>
498499
</SettingRow>
499500
<SettingRow

0 commit comments

Comments
 (0)