Skip to content

Commit e2a154f

Browse files
committed
removed extra code in pug files
1 parent dd7fd87 commit e2a154f

File tree

14 files changed

+52
-209
lines changed

14 files changed

+52
-209
lines changed

src/components/code/code.pug

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,14 @@
11

2-
mixin code(options = {})
2+
mixin code(label = '')
33
-
4-
const {
5-
label = '',
6-
addClass = '',
7-
isLabeled = false,
8-
} = options;
9-
104
const BASE_CLASS = 'code';
11-
let className = BASE_CLASS;
125
const CODE_TOP = '$(\'.demo\').RangeSliderFox({';
136
const CODE_BOTTOM = '})';
147
15-
if addClass
16-
- className += ` ${addClass}`
17-
18-
19-
fieldset(class=`${className} js-${BASE_CLASS}`)
20-
if !isLabeled
8+
fieldset(class=`${BASE_CLASS} js-${BASE_CLASS}`)
9+
if label
2110
legend(class=`${BASE_CLASS}__label`)= label
2211

23-
2412
div(class=`${BASE_CLASS}__config`)
2513
p(class=`${BASE_CLASS}__lang-js`)=CODE_TOP
2614
ul(class=`${BASE_CLASS}__options js-${BASE_CLASS}__options`)

src/components/footer/footer.pug

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1-
mixin footer(options = {})
1+
mixin footer()
22
-
3-
const {
4-
addClass = '',
5-
} = options;
6-
73
const BASE_CLASS = 'footer'
8-
let className = BASE_CLASS
94
10-
if addClass
11-
- className += ` ${addClass}`
12-
13-
footer(class=className)
5+
footer(class=BASE_CLASS)
146
p Клюшин А. © 2022

src/components/grid/grid.pug

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,31 @@
11
include ../toggle/toggle.pug
22
include ../text-field/text-field.pug
33

4-
mixin grid(options = {})
5-
-
6-
const {
7-
label = '',
8-
addClass = '',
9-
isLabeled = false,
10-
} = options;
11-
12-
const CLASS_COMPONENT = 'grid'
13-
let className = CLASS_COMPONENT
14-
15-
if addClass
16-
- className += ` ${addClass}`
17-
4+
mixin grid(label = '')
185
-
6+
const BASE_CLASS = 'grid'
197
const data = require('./grid.json');
208
const textField = data.textField
219
22-
fieldset(class=`${className} js-${CLASS_COMPONENT}`)
23-
if !isLabeled
24-
legend(class=`${CLASS_COMPONENT}__label`)= label
10+
fieldset(class=`${BASE_CLASS} js-${BASE_CLASS}`)
11+
if label
12+
legend(class=`${BASE_CLASS}__label`)= label
2513

26-
div(class=`${CLASS_COMPONENT}__grid-wrapper js-${CLASS_COMPONENT}__grid-wrapper`)
14+
div(class=`${BASE_CLASS}__grid-wrapper js-${BASE_CLASS}__grid-wrapper`)
2715
+toggle({
2816
header: 'Grid',
2917
})
3018

31-
div(class=`${CLASS_COMPONENT}__snap-wrapper js-${CLASS_COMPONENT}__snap-wrapper`)
19+
div(class=`${BASE_CLASS}__snap-wrapper js-${BASE_CLASS}__snap-wrapper`)
3220
+toggle({
3321
header: 'Snap',
3422
})
3523

36-
div(class=`${CLASS_COMPONENT}__interval-wrapper js-${CLASS_COMPONENT}__interval-wrapper`)
24+
div(class=`${BASE_CLASS}__interval-wrapper js-${BASE_CLASS}__interval-wrapper`)
3725
+text-field(textField.interval)
3826

39-
div(class=`${CLASS_COMPONENT}__step-wrapper js-${CLASS_COMPONENT}__step-wrapper`)
27+
div(class=`${BASE_CLASS}__step-wrapper js-${BASE_CLASS}__step-wrapper`)
4028
+text-field(textField.step)
4129

42-
div(class=`${CLASS_COMPONENT}__round-wrapper js-${CLASS_COMPONENT}__round-wrapper`)
30+
div(class=`${BASE_CLASS}__round-wrapper js-${BASE_CLASS}__round-wrapper`)
4331
+text-field(textField.round)

src/components/header/header.pug

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
mixin header(options = {})
1+
mixin header()
22
-
3-
const {
4-
addClass = '',
5-
} = options;
6-
73
const BASE_CLASS = 'header'
8-
let className = BASE_CLASS
9-
10-
if addClass
11-
- className += ` ${addClass}`
12-
134
14-
header(class=className)
5+
header(class=BASE_CLASS)
156
div(class=`${BASE_CLASS}__wrapper`)
167
p(class=`${BASE_CLASS}__version`) version: 1.0
178

src/components/hints/hints.pug

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,14 @@
11
include ../toggle/toggle.pug
22
include ../text-field/text-field.pug
33

4-
mixin hints(options = {})
4+
mixin hints(label = '')
55
-
6-
const {
7-
label = '',
8-
addClass = '',
9-
isLabeled = false,
10-
} = options;
11-
126
const BASE_CLASS = 'hints'
13-
let className = BASE_CLASS
14-
15-
if addClass
16-
- className += ` ${addClass}`
17-
18-
-
197
const data = require('./hints.json');
208
const textField = data.textField
219
22-
fieldset(class=`${className} js-${BASE_CLASS}`)
23-
if !isLabeled
10+
fieldset(class=`${BASE_CLASS} js-${BASE_CLASS}`)
11+
if label
2412
legend(class=`${BASE_CLASS}__label`)= label
2513

2614

src/components/input-data/input-data.pug

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
11
include ../text-field/text-field.pug
22

3-
mixin input-data(options = {})
3+
mixin input-data(label = '')
44
-
5-
const {
6-
label = '',
7-
addClass = '',
8-
isLabeled
9-
} = options;
10-
115
const BASE_CLASS = 'input-data'
12-
let className = BASE_CLASS
136
14-
if addClass
15-
- className += ` ${addClass}`
16-
17-
18-
fieldset(class=`${className} js-${BASE_CLASS}`)
19-
if !isLabeled
7+
fieldset(class=`${BASE_CLASS} js-${BASE_CLASS}`)
8+
if label
209
legend(class=`${BASE_CLASS}__label`)= label
2110

22-
2311
div(class=`${BASE_CLASS}__value-wrapper`)
2412
+text-field({
2513
label: 'value',

src/components/keyboard-control/keyboard-control.pug

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
11
include ../text-field/text-field.pug
22

3-
mixin keyboard-control(options = {})
3+
mixin keyboard-control(label = '')
44
-
5-
const {
6-
label = '',
7-
addClass = '',
8-
isLabeled = false
9-
} = options;
10-
115
const BASE_CLASS = 'keyboard-control'
12-
let className = BASE_CLASS
13-
14-
if addClass
15-
- className += ` ${addClass}`
16-
17-
-
186
const data = require('./keyboard-control.json');
197
const textField = data.textField
208
21-
fieldset(class=`${className} js-${BASE_CLASS}`)
22-
if !isLabeled
9+
fieldset(class=`${BASE_CLASS} js-${BASE_CLASS}`)
10+
if label
2311
legend(class=`${BASE_CLASS}__label`)= label
2412

25-
2613
div(class=`${BASE_CLASS}__one-wrapper js-${BASE_CLASS}__one-wrapper`)
2714
+text-field(textField.one)
2815

src/components/miscellaneous/miscellaneous.pug

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,16 @@
11
include ../toggle/toggle.pug
22
include ../select/select.pug
33

4-
mixin miscellaneous(options = {})
4+
mixin miscellaneous(label = '')
55
-
66
const BASE_CLASS = 'miscellaneous'
7-
8-
const {
9-
label = '',
10-
addClass = '',
11-
isLabeled = false,
12-
} = options;
13-
14-
let className = BASE_CLASS
15-
16-
if addClass
17-
- className += ` ${addClass}`
18-
19-
-
207
const data = require('./miscellaneous.json');
218
const selectData = data.select
229
23-
fieldset(class=`${className} js-${BASE_CLASS}`)
24-
if !isLabeled
10+
fieldset(class=`${BASE_CLASS} js-${BASE_CLASS}`)
11+
if label
2512
legend(class=`${BASE_CLASS}__label`)= label
2613

27-
2814
div(class=`${BASE_CLASS}__double-wrapper js-${BASE_CLASS}__double-wrapper`)
2915
+toggle({
3016
header: 'double',

src/components/panel/panel.pug

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,11 @@ include ../miscellaneous/miscellaneous.pug
66
include ../code/code.pug
77
include ../keyboard-control/keyboard-control.pug
88

9-
mixin panel(options = {})
9+
mixin panel(theme = 'base')
1010
-
11-
const {
12-
addClass = '',
13-
theme = 'base',
14-
} = options;
15-
1611
const BASE_CLASS = 'panel'
17-
let className = BASE_CLASS
18-
19-
if addClass
20-
- className += ` ${addClass}`
21-
2212
23-
div(class=`${className} js-${BASE_CLASS}`)
13+
div(class=`${BASE_CLASS} js-${BASE_CLASS}`)
2414
div(class=`${BASE_CLASS}__slider-wrapper js-${BASE_CLASS}__slider-wrapper`)
2515
input(class=`rslider__${theme} visually-hidden`
2616
type='text'
@@ -31,22 +21,22 @@ mixin panel(options = {})
3121
)
3222

3323
div(class=`${BASE_CLASS}__values-wrapper`)
34-
+values({label: 'Values',})
24+
+values('Values')
3525

3626
div(class=`${BASE_CLASS}__input-data-wrapper`)
37-
+input-data({label: 'Input data',})
27+
+input-data('Input data')
3828

3929
div(class=`${BASE_CLASS}__keyboard-control-wrapper`)
40-
+keyboard-control({label: 'keyboard control',})
30+
+keyboard-control('keyboard control')
4131

4232
div(class=`${BASE_CLASS}__grid-wrapper`)
43-
+grid({label: 'Grid',})
33+
+grid('Grid')
4434

4535
div(class=`${BASE_CLASS}__different-wrapper`)
46-
+miscellaneous({label: 'Miscellaneous',})
36+
+miscellaneous('Miscellaneous')
4737

4838
div(class=`${BASE_CLASS}__hints-wrapper`)
49-
+hints({label: 'Hints',})
39+
+hints('Hints')
5040

5141
div(class=`${BASE_CLASS}__code-wrapper`)
52-
+code({label: 'Config code',})
42+
+code('Config code')

src/components/select/select.pug

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,16 @@ mixin select(options = {})
33
-
44
const {
55
label = '',
6-
isLabeled = false,
76
list = [],
87
name = '',
9-
modifier = '',
10-
addClass = '',
118
} = options;
129
1310
const BASE_CLASS = 'select'
14-
let className = BASE_CLASS
15-
16-
if modifier
17-
- className += ` ${BASE_CLASS}_${modifier}`
18-
19-
if addClass
20-
- className += ` ${addClass}`
21-
2211
23-
div(class=`${className} js-${BASE_CLASS}`)
24-
if !isLabeled
12+
div(class=`${BASE_CLASS} js-${BASE_CLASS}`)
13+
if label
2514
p(class=`${BASE_CLASS}__label-text`)= label
2615

27-
2816
div(class=`${BASE_CLASS}__displayed-wrapper js-${BASE_CLASS}__displayed-wrapper`)
2917
button(class=`${BASE_CLASS}__displayed js-${BASE_CLASS}__displayed`)
3018
img(class=`${BASE_CLASS}__tip js-${BASE_CLASS}__tip` src=require('./img/tip.svg') alt='угалок')

src/components/text-field/text-field.pug

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,12 @@ mixin text-field(options)
55
placeholder = '',
66
typeField = '',
77
name = '',
8-
addClass = '',
9-
isLabeled = false,
108
} = options;
119
const BASE_CLASS = 'text-field'
12-
let className = BASE_CLASS
1310
14-
if addClass
15-
- className += ` ${addClass}`
16-
17-
18-
div(class=className)
11+
div(class=BASE_CLASS)
1912
label(class=`${BASE_CLASS}__label`)
20-
if !isLabeled
13+
if label
2114
= label
2215

2316
input(class=`${BASE_CLASS}__input` type=typeField placeholder=placeholder value='' name=name)

src/components/toggle/toggle.pug

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,14 @@ mixin toggle(options = {})
33
const {
44
header = '',
55
label = '',
6-
modifier = '',
7-
addClass = '',
8-
isLabeled,
96
} = options;
107
118
const BASE_CLASS = 'toggle'
12-
let className = BASE_CLASS
139
14-
if(modifier){
15-
className += ` ${BASE_CLASS}_${modifier}`
16-
}
17-
if(addClass){
18-
className += ` ${addClass}`
19-
}
10+
div(class=BASE_CLASS)
11+
if header
12+
p(class=`${BASE_CLASS}__header`)= header
2013

21-
div(class=className)
22-
- if(!isLabeled){
23-
p(class=`${BASE_CLASS}__header`)= header
24-
-}
25-
2614
div(class=`${BASE_CLASS}__wrapper`)
2715
label(class=`${BASE_CLASS}__label`)= label
2816
input(class=`${BASE_CLASS}__input` type='checkbox' name='toggle')

0 commit comments

Comments
 (0)