Skip to content

Commit 966c0ae

Browse files
committed
feat: extract css to theme
1 parent 76ef7de commit 966c0ae

File tree

8 files changed

+59
-37
lines changed

8 files changed

+59
-37
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/components/dialog/style.scss src/components/Modal/style.scss

-14
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ $confirm: 'confirm';
44

55
#{prefix($modal)} {
66
box-sizing: border-box;
7-
color: #fff;
87
font-size: 14px;
98
margin: 0 auto;
109
max-width: calc(100vw - 32px);
@@ -15,7 +14,6 @@ $confirm: 'confirm';
1514
width: auto;
1615

1716
&-mask {
18-
background-color: rgba(0, 0, 0, 0.45);
1917
bottom: 0;
2018
height: 100%;
2119
left: 0;
@@ -48,18 +46,13 @@ $confirm: 'confirm';
4846
}
4947

5048
&-content {
51-
background-color: #1e1e1e;
52-
box-shadow: rgba(0, 0, 0, 0.31) 0 0 8px;
53-
color: #fff;
5449
font-size: 18px;
5550
padding: 0 15px;
5651
pointer-events: auto;
5752
position: relative;
5853
}
5954

6055
&-header {
61-
background: inherit;
62-
color: #fff;
6356
font-size: 24px;
6457
padding: 16px 0;
6558
}
@@ -76,8 +69,6 @@ $confirm: 'confirm';
7669
}
7770

7871
&-close {
79-
background: 0 0;
80-
border: 0;
8172
color: #fff;
8273
cursor: pointer;
8374
font-weight: 700;
@@ -122,10 +113,6 @@ $confirm: 'confirm';
122113
.codicon {
123114
font-size: 48px !important;
124115
}
125-
126-
.codicon-warning {
127-
color: rgb(204, 167, 0);
128-
}
129116
}
130117

131118
&_content {
@@ -147,7 +134,6 @@ $confirm: 'confirm';
147134
}
148135

149136
&--detail {
150-
color: rgb(187, 187, 187);
151137
font-size: 13px;
152138
}
153139
}

src/style/theme.scss

+40
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
@import 'mo/components/input/style';
2727
@import 'mo/components/select/style';
2828
@import 'mo/components/checkbox/style';
29+
@import 'mo/components/dialog';
2930

3031
// =============== Workbench =============== //
3132
#{prefix($workbench)} {
@@ -269,3 +270,42 @@
269270
}
270271
}
271272
}
273+
274+
#{$modal} {
275+
color: #fff;
276+
277+
&-mask {
278+
background-color: rgba(0, 0, 0, 0.45);
279+
280+
}
281+
282+
&-content {
283+
background-color: #1e1e1e;
284+
box-shadow: rgba(0, 0, 0, 0.31) 0 0 8px;
285+
color: #fff;
286+
}
287+
288+
&-header {
289+
background: inherit;
290+
color: #fff;
291+
}
292+
293+
&-close {
294+
color: #fff;
295+
296+
}
297+
}
298+
299+
#{$confirm} {
300+
&__indicator {
301+
.codicon-warning {
302+
color: rgb(204, 167, 0);
303+
}
304+
}
305+
306+
&__message {
307+
&--detail {
308+
color: rgb(187, 187, 187);
309+
}
310+
}
311+
}

stories/components/17-Dialog.stories.tsx

+19-23
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import { useState } from 'react';
3-
import Modal from 'mo/components/dialog';
3+
import Modal from 'mo/components/Modal';
44
import { Button } from 'mo/components/button';
55
import { storiesOf } from '@storybook/react';
66
import { withKnobs } from '@storybook/addon-knobs';
@@ -46,28 +46,24 @@ stories.add('Basic Usage', () => {
4646
等语法糖方法
4747
</p>
4848
<div>
49-
<h3>使用示例 1 - 基本使用</h3>
50-
<div>
51-
<div id="container" style={{ padding: 24 }}/>
52-
<Button type="primary" onClick={showModal}>
53-
Open Modal
54-
</Button>
55-
<Modal
56-
width={520}
57-
title="Tweet us your feedback"
58-
destroyOnClose={true}
59-
visible={isModalVisible}
60-
onOk={handleOk}
61-
onCancel={handleCancel}
62-
>
63-
<p>Some contents...</p>
64-
<p>Some contents...</p>
65-
<p>Some contents...</p>
66-
</Modal>
67-
<br/>
68-
<br/>
69-
<Button onClick={showConfirm}>Confirm</Button>
70-
</div>
49+
<h3>使用示例 1 - Modal</h3>
50+
<Button type="primary" onClick={showModal}>
51+
Open Modal
52+
</Button>
53+
<Modal
54+
width={520}
55+
title="Tweet us your feedback"
56+
destroyOnClose={true}
57+
visible={isModalVisible}
58+
onOk={handleOk}
59+
onCancel={handleCancel}
60+
>
61+
<p>Some contents...</p>
62+
<p>Some contents...</p>
63+
<p>Some contents...</p>
64+
</Modal>
65+
<h3>使用示例 2 - confirm</h3>
66+
<Button onClick={showConfirm}>Confirm</Button>
7167
</div>
7268
</>
7369
);

0 commit comments

Comments
 (0)