Skip to content

Commit 400e214

Browse files
committed
fix: 适配v14
1 parent 90af513 commit 400e214

File tree

4 files changed

+55
-9
lines changed

4 files changed

+55
-9
lines changed

src/packages/switch/demos/h5/demo5.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
import React from 'react'
2-
import { Cell, Switch } from '@nutui/nutui-react'
2+
import { Cell, Space, Switch } from '@nutui/nutui-react'
33
import { Check, Close } from '@nutui/icons-react'
44

55
const Demo5 = () => {
66
return (
77
<Cell>
8-
<Switch defaultChecked activeText={<Check />} inactiveText={<Close />} />
8+
<Space>
9+
<Switch
10+
defaultChecked
11+
activeText={<Check />}
12+
inactiveText={<Close />}
13+
/>
14+
<Switch
15+
defaultChecked
16+
activeText={<Check />}
17+
inactiveText={<Close />}
18+
disabled
19+
/>
20+
<Switch activeText={<Check />} inactiveText={<Close />} disabled />
21+
</Space>
922
</Cell>
1023
)
1124
}

src/packages/switch/demos/taro/demo5.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
import React from 'react'
2-
import { Cell, Switch } from '@nutui/nutui-react-taro'
2+
import { Cell, Space, Switch } from '@nutui/nutui-react-taro'
33
import { Check, Close } from '@nutui/icons-react-taro'
44

55
const Demo5 = () => {
66
return (
77
<Cell>
8-
<Switch defaultChecked activeText={<Check />} inactiveText={<Close />} />
8+
<Space>
9+
<Switch
10+
defaultChecked
11+
activeText={<Check />}
12+
inactiveText={<Close />}
13+
/>
14+
<Switch
15+
defaultChecked
16+
activeText={<Check />}
17+
inactiveText={<Close />}
18+
disabled
19+
/>
20+
<Switch activeText={<Check />} inactiveText={<Close />} disabled />
21+
</Space>
922
</Cell>
1023
)
1124
}

src/packages/switch/switch.scss

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,28 @@
5858
white-space: nowrap;
5959
color: $switch-label-text-color;
6060
font-size: $switch-label-font-size;
61+
.nut-icon {
62+
color: $switch-label-text-color;
63+
}
6164
&-open {
62-
margin: 0 calc($switch-height - $switch-border-width + 5px) 0 7px;
65+
margin: 0 calc($switch-height - $switch-border-width + 3px) 0 7px;
6366
&-rtl {
64-
margin: 0 7px 0 calc($switch-height - $switch-border-width + 5px);
67+
margin: 0 7px 0 calc($switch-height - $switch-border-width + 3px);
6568
}
6669
}
6770

6871
&-close {
69-
margin: 0 7px 0 calc($switch-height - $switch-border-width + 5px);
72+
margin: 0 7px 0 calc($switch-height - $switch-border-width + 3px);
7073
&-rtl {
71-
margin: 0 calc($switch-height - $switch-border-width + 5px) 0 7px;
74+
margin: 0 calc($switch-height - $switch-border-width + 3px) 0 7px;
7275
}
7376
}
7477

7578
&-close-disabled {
7679
color: $switch-close-disabled-label-text-color;
80+
.nut-icon {
81+
color: $switch-close-disabled-label-text-color;
82+
}
7783
}
7884
}
7985

src/styles/variables.scss

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,9 +882,23 @@ $switch-inside-border-radius: var(
882882
--nutui-switch-inside-border-radius,
883883
$radius-full
884884
) !default;
885+
/* #ifdef harmony */
885886
$switch-inside-box-shadow: var(
886887
--nutui-switch-inside-box-shadow,
887-
0px 2px 6px 0px rgba(0, 0, 0, 0.4)
888+
0px 2px 6px 0px rgba(0, 0, 0, 0.1)
889+
) !default;
890+
/* #endif */
891+
/* #ifndef harmony */
892+
$switch-inside-box-shadow: var(
893+
--nutui-switch-inside-box-shadow,
894+
0px 2px 1px 0px rgba(0, 0, 0, 0.06),
895+
0px 2px 6px 0px rgba(0, 0, 0, 0.1),
896+
0px 0px 0px 1px rgba(0, 0, 0, 0.02)
897+
) !default;
898+
/* #endif */
899+
$switch-inside-box-shadow: var(
900+
--nutui-switch-inside-box-shadow,
901+
0px 2px 6px 0px rgba(0, 0, 0, 0.1)
888902
) !default;
889903
$switch-label-text-color: var(
890904
--nutui-switch-label-text-color,

0 commit comments

Comments
 (0)