Skip to content

Commit 671a04c

Browse files
M. Weberrohityadavcloud
authored andcommitted
refactoring of less rules (#26)
This is a difficult first step to more unified less code. replace inline styles with class names and define rules at the end of vue files remove first ant-pro classes (no benefits with it yet) move some less rules to components Signed-off-by: Rohit Yadav <[email protected]>
1 parent c614de8 commit 671a04c

31 files changed

+690
-412
lines changed

ui/src/App.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default {
2323
}
2424
</script>
2525
<style>
26-
#app {
27-
height: 100%;
28-
}
26+
#app {
27+
height: 100%;
28+
}
2929
</style>

ui/src/components/FooterToolbar/FooterToolBar.vue

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
2-
<div :class="prefixCls">
3-
<div style="float: left">
2+
<div class="footer-toolbar">
3+
<div class="footer-toolbar-left">
44
<slot name="extra">{{ extra }}</slot>
55
</div>
6-
<div style="float: right">
6+
<div class="footer-toolbar-right">
77
<slot></slot>
88
</div>
99
</div>
@@ -15,7 +15,7 @@ export default {
1515
props: {
1616
prefixCls: {
1717
type: String,
18-
default: 'ant-pro-footer-toolbar'
18+
default: 'reduced'
1919
},
2020
extra: {
2121
type: [String, Object],
@@ -26,5 +26,32 @@ export default {
2626
</script>
2727

2828
<style lang="less" scoped>
29+
.footer-toolbar {
30+
position: fixed;
31+
width: 100%;
32+
bottom: 0;
33+
right: 0;
34+
height: 56px;
35+
line-height: 56px;
36+
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.03);
37+
background: #fff;
38+
border-top: 1px solid #e8e8e8;
39+
padding: 0 24px;
40+
z-index: 9;
2941
42+
&:after {
43+
content: "";
44+
display: block;
45+
clear: both;
46+
}
47+
48+
&-left {
49+
float: left;
50+
}
51+
52+
&-right {
53+
float: right;
54+
}
55+
56+
}
3057
</style>

ui/src/components/MultiTab/MultiTab.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ export default {
157157
})
158158
159159
return (
160-
<div class="ant-pro-multi-tab">
161-
<div class="ant-pro-multi-tab-wrapper">
160+
<div class="multi-tab">
161+
<div class="multi-tab-wrapper">
162162
<a-tabs
163163
hideAdd
164164
type={'editable-card'}
@@ -173,3 +173,15 @@ export default {
173173
}
174174
}
175175
</script>
176+
177+
<style lang="less" scoped>
178+
.multi-tab {
179+
margin: -23px -24px 24px -24px;
180+
background: #fff;
181+
}
182+
183+
.topmenu .multi-tab-wrapper {
184+
max-width: 1200px;
185+
margin: 0 auto;
186+
}
187+
</style>

ui/src/components/NumberInfo/NumberInfo.vue

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default {
2121
props: {
2222
prefixCls: {
2323
type: String,
24-
default: 'ant-pro-number-info'
24+
default: 'number-info'
2525
},
2626
total: {
2727
type: Number,
@@ -50,5 +50,57 @@ export default {
5050
</script>
5151

5252
<style lang="less" scoped>
53-
@import "index";
53+
@import '~ant-design-vue/lib/style/themes/default';
54+
55+
.number-info {
56+
57+
.number-info-subtitle {
58+
color: @text-color-secondary;
59+
font-size: @font-size-base;
60+
height: 22px;
61+
line-height: 22px;
62+
overflow: hidden;
63+
text-overflow: ellipsis;
64+
word-break: break-all;
65+
white-space: nowrap;
66+
}
67+
68+
.number-info-value {
69+
margin-top: 4px;
70+
font-size: 0;
71+
overflow: hidden;
72+
text-overflow: ellipsis;
73+
word-break: break-all;
74+
white-space: nowrap;
75+
76+
& > span {
77+
color: @heading-color;
78+
display: inline-block;
79+
line-height: 32px;
80+
height: 32px;
81+
font-size: 24px;
82+
margin-right: 32px;
83+
}
84+
85+
.sub-total {
86+
color: @text-color-secondary;
87+
font-size: @font-size-lg;
88+
vertical-align: top;
89+
margin-right: 0;
90+
i {
91+
font-size: 12px;
92+
transform: scale(0.82);
93+
margin-left: 4px;
94+
}
95+
:global {
96+
.anticon-caret-up {
97+
color: @red-6;
98+
}
99+
.anticon-caret-down {
100+
color: @green-6;
101+
}
102+
}
103+
}
104+
}
105+
}
54106
</style>

ui/src/components/Trend/Trend.vue

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div :class="[prefixCls, reverseColor && 'reverse-color' ]">
2+
<div class="trend" :class="[ reverseColor && 'reverse-color' ]">
33
<span>
44
<slot name="term"></slot>
55
<span class="item-text">
@@ -31,5 +31,43 @@ export default {
3131
</script>
3232

3333
<style lang="less" scoped>
34-
@import "index";
34+
@import "~ant-design-vue/lib/style/themes/default";
35+
.trend {
36+
display: inline-block;
37+
font-size: @font-size-base;
38+
line-height: 22px;
39+
40+
.up,
41+
.down {
42+
margin-left: 4px;
43+
position: relative;
44+
top: 1px;
45+
46+
i {
47+
font-size: 12px;
48+
transform: scale(0.83);
49+
}
50+
}
51+
52+
.item-text {
53+
display: inline-block;
54+
margin-left: 8px;
55+
color: rgba(0,0,0,.85);
56+
}
57+
58+
.up {
59+
color: @red-6;
60+
}
61+
.down {
62+
color: @green-6;
63+
top: -1px;
64+
}
65+
66+
&.reverse-color .up {
67+
color: @green-6;
68+
}
69+
&.reverse-color .down {
70+
color: @red-6;
71+
}
72+
}
3573
</style>

ui/src/components/chart/Bar.vue

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<template>
2-
<div :style="{ padding: '0 0 32px 32px' }">
3-
<h4 :style="{ marginBottom: '20px' }">{{ title }}</h4>
2+
<div class="bar-wrapper">
3+
<h4 class="bar-headline">{{ title }}</h4>
44
<v-chart
5-
height="254"
5+
class="bar-chart"
66
:data="data"
7-
:forceFit="true"
8-
:padding="['auto', 'auto', '40', '50']">
7+
:forceFit="true">
98
<v-tooltip />
109
<v-axis />
1110
<v-bar position="x*y"/>
@@ -55,3 +54,20 @@ export default {
5554
}
5655
}
5756
</script>
57+
58+
<style lang="less" scoped>
59+
.bar {
60+
&-wrapper {
61+
padding: 0 0 32px 32px;
62+
}
63+
64+
&-headline {
65+
margin-bottom: 20px;
66+
}
67+
68+
&-chart {
69+
height: 254px;
70+
padding: 0 0 40px 50px;
71+
}
72+
}
73+
</style>
Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<a-card :loading="loading" :body-style="{ padding: '20px 24px 8px' }" :bordered="false">
33
<div class="chart-card-header">
4-
<div class="meta">
4+
<div class="chart-card-meta">
55
<span class="chart-card-title">
66
<slot name="title">
77
{{ title }}
@@ -11,19 +11,19 @@
1111
<slot name="action"></slot>
1212
</span>
1313
</div>
14-
<div class="total">
14+
<div class="chart-card-total">
1515
<slot name="total">
1616
<span>{{ typeof total === 'function' && total() || total }}</span>
1717
</slot>
1818
</div>
1919
</div>
2020
<div class="chart-card-content">
21-
<div class="content-fix">
21+
<div class="chart-card-content-fix">
2222
<slot></slot>
2323
</div>
2424
</div>
2525
<div class="chart-card-footer">
26-
<div class="field">
26+
<div class="chart-card-field">
2727
<slot name="footer"></slot>
2828
</div>
2929
</div>
@@ -52,61 +52,59 @@ export default {
5252
</script>
5353

5454
<style lang="less" scoped>
55-
.chart-card-header {
55+
.chart-card {
56+
&-header {
5657
position: relative;
5758
overflow: hidden;
5859
width: 100%;
60+
}
5961
60-
.meta {
61-
position: relative;
62-
overflow: hidden;
63-
width: 100%;
64-
color: rgba(0, 0, 0, .45);
65-
font-size: 14px;
66-
line-height: 22px;
67-
}
62+
&-meta {
63+
position: relative;
64+
overflow: hidden;
65+
width: 100%;
66+
color: rgba(0, 0, 0, .45);
67+
font-size: 14px;
68+
line-height: 22px;
6869
}
6970
70-
.chart-card-action {
71+
&-action {
7172
cursor: pointer;
7273
position: absolute;
7374
top: 0;
7475
right: 0;
7576
}
7677
77-
.chart-card-footer {
78+
&-footer {
7879
border-top: 1px solid #e8e8e8;
7980
padding-top: 9px;
8081
margin-top: 8px;
82+
}
8183
82-
> * {
83-
position: relative;
84-
}
85-
86-
.field {
87-
white-space: nowrap;
88-
overflow: hidden;
89-
text-overflow: ellipsis;
90-
margin: 0;
91-
}
84+
&-field {
85+
position: relative;
86+
white-space: nowrap;
87+
overflow: hidden;
88+
text-overflow: ellipsis;
89+
margin: 0;
9290
}
9391
94-
.chart-card-content {
92+
&-content {
9593
margin-top: -42px;
9694
margin-bottom: 12px;
9795
position: relative;
9896
height: 100%;
9997
width: 100%;
98+
}
10099
101-
.content-fix {
100+
&-content-fix {
102101
position: relative;
103-
left: 0;
104-
bottom: 0;
105-
width: 100%;
106-
}
102+
left: 0;
103+
bottom: 0;
104+
width: 100%;
107105
}
108106
109-
.total {
107+
&-total {
110108
overflow: hidden;
111109
text-overflow: ellipsis;
112110
word-break: break-all;
@@ -118,4 +116,5 @@ export default {
118116
line-height: 38px;
119117
height: 38px;
120118
}
119+
}
121120
</style>

0 commit comments

Comments
 (0)