Skip to content

Commit ce67bb4

Browse files
farenagVguy
authored andcommitted
updated README with new feature
1 parent 72fee9b commit ce67bb4

File tree

2 files changed

+32
-22
lines changed

2 files changed

+32
-22
lines changed

.github/README.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -366,15 +366,15 @@ Instead of using `transition` property with a custom transition name, you can si
366366
This can be done in the same manner as with the other classes, e.g:
367367

368368
```css
369-
.color-input.user .picker-popup-enter-from {
369+
.picker-popup-enter-from {
370370
transform: translateY(-100%) scale(.1);
371371
}
372-
.color-input.user .picker-popup-leave-to {
372+
.picker-popup-leave-to {
373373
transform: scale(3);
374374
}
375375
/* and if you want to change the durations as well */
376-
.color-input.user .picker-popup-enter-active,
377-
.color-input.user .picker-popup-leave-active {
376+
.picker-popup-enter-active,
377+
.picker-popup-leave-active {
378378
transition: all .5s;
379379
}
380380
```
@@ -415,29 +415,29 @@ For example:
415415
height: 100px;
416416
border-radius: 50px;
417417
}
418-
.color-input.user .picker-popup {
418+
.picker-popup.user {
419419
/* dark mode for popup window */
420420
background: #000;
421421
color: #fbfbfb;
422422
/* and make it wide */
423423
width: 400px;
424424
}
425-
.color-input.user .slider {
425+
.picker-popup .slider {
426426
/* thin out the sliders and make them wider */
427427
height: 2px;
428428
width: 92%;
429429
}
430-
.color-input.user .saturation-area {
430+
.picker-popup .saturation-area {
431431
/* bigger picking area */
432432
height: 150px;
433433
}
434-
.color-input.user .slider-pointer {
434+
.picker-popup .slider-pointer {
435435
/* make slider pointers square-ish and 10x10 */
436436
border-radius: 4px;
437437
width: 10px;
438438
height: 10px;
439439
}
440-
.color-input.user .saturation-pointer {
440+
.picker-popup .saturation-pointer {
441441
/* increase saturation pointer size */
442442
width: 40px;
443443
height: 40px;
@@ -450,10 +450,19 @@ For example:
450450

451451
Here's the base structure of the component:
452452
```xml
453+
<!-- When there is no appendTo set up -->
453454
<div class="color-input">
454455
<div class="box [active] [disabled]"></div>
455456
<div class="picker-popup"></div> <!-- position: absolute -->
456457
</div>
458+
459+
<!-- When there is appendTo set up -->
460+
<div class="color-input">
461+
<div class="box [active] [disabled]"></div>
462+
</div>
463+
<div id="appendToId">
464+
<div class="picker-popup"></div> <!-- position: absolute -->
465+
</div>
457466
```
458467
Root element wraps arond the clickable box, but if you want to change box styles, you should select it like this: `.color-input.user .box`.
459468

@@ -465,17 +474,16 @@ _Changing size of the root element independently from the box will mess with how
465474

466475
Inline styles will only let you style the root element, which is typically not what you want to style very often.
467476

468-
### Use `.color-input.user` to override default styles
477+
### Use `.user` to override default styles
469478

470-
There is no need to use `!important`. Default styles are easily overridable by adding specificity to the selectors with `.color-input.user .<classname>`.
479+
There is no need to use `!important`. Default styles are easily overridable by adding specificity to the selectors with `.color-input.user .box` or `.picker-popup.user`.
471480

472481
And if you use scss that's even more natural with nesting:
473482
```scss
474483
.color-input.user {
475484
.box {}
476-
.picker-popup {}
477-
// etc
478485
}
486+
.picker-popup.user {}
479487
```
480488

481489
### Set margin on the root element

dev/demo-styles.css

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
.color-input.user .box.active .inner {
1010
transform: scale(.9) rotate(90deg);
1111
}
12-
.color-input.user .box.disabled {}
13-
.color-input.user .picker-popup {}
14-
.color-input.user .slider {}
15-
.color-input.user .slider-pointer {}
16-
.color-input.user .saturation-pointer {}
17-
.color-input.user .picker-popup-enter-from,
18-
.color-input.user .picker-popup-leave-to {}
19-
.color-input.user .picker-popup-enter-active,
20-
.color-input.user .picker-popup-leave-active {}
12+
13+
.picker-popup-enter-from,
14+
.picker-popup-leave-to {}
15+
.picker-popup-enter-active,
16+
.picker-popup-leave-active {}
17+
18+
.picker-popup.user {}
19+
.picker-popup.user .box.disabled {}
20+
.picker-popup.user .slider {}
21+
.picker-popup.user .slider-pointer {}
22+
.picker-popup.user .saturation-pointer {}

0 commit comments

Comments
 (0)