Skip to content

Commit

Permalink
Add chip atom
Browse files Browse the repository at this point in the history
  • Loading branch information
nassimerrahoui committed Oct 25, 2022
1 parent 4215b2d commit e2d2492
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/style/atom/_atom.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import 'button/button';
@import 'chip/chip';
@import 'icon/icon';
@import 'input/input';
@import 'label/label';
Expand Down
2 changes: 2 additions & 0 deletions src/main/style/atom/atom.pug
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ block content
include /documentation/atomic-design/quote/atom
.tikui-vertical-spacing--line
include:componentDoc(height=100) button/button.md
.tikui-vertical-spacing--line
include:componentDoc(height=340) chip/chip.md
.tikui-vertical-spacing--line
include:componentDoc(height=70) icon/icon.md
.tikui-vertical-spacing--line
Expand Down
34 changes: 34 additions & 0 deletions src/main/style/atom/chip/_chip.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.jhlite-chip {
display: flex;
flex-direction: column;
gap: 5px;
border: 1px solid $jhlite-global-color-fill-primary-dark;
border-radius: 6px;
background: $jhlite-global-color-fill-light;
text-align: center;

&--title {
padding-top: 6px;
padding-bottom: 6px;
text-align: center;
}

&--description {
border-top: 1px dotted $jhlite-global-color-fill-primary-dark;
padding-top: 6px;
padding-bottom: 6px;
font-size: 0.8em;
}

&.-selectable {
cursor: pointer;
}

&.-valid-highlighted {
animation: $jhlite-valid-highlight-animation;
}

&.-invalid-highlighted {
animation: $jhlite-invalid-highlight-animation;
}
}
9 changes: 9 additions & 0 deletions src/main/style/atom/chip/chip.code.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include chip.mixin.pug

+jhlite-chip
+jhlite-chip({selectable: true})
+jhlite-chip({selectable: true, validHighlighted: true})
+jhlite-chip({selectable: true, invalidHighlighted: true})
+jhlite-chip({selectable: true, extended: true})
+jhlite-chip({selectable: true, validHighlighted: true, extended: true})
+jhlite-chip({selectable: true, invalidHighlighted: true, extended: true})
1 change: 1 addition & 0 deletions src/main/style/atom/chip/chip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Chip
9 changes: 9 additions & 0 deletions src/main/style/atom/chip/chip.mixin.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
mixin jhlite-chip(options)
-const { selectable: isSelectable, validHighlighted: isValidHighlighted, invalidHighlighted: isInvalidHighlighted, extended: isExtended } = options || {};
-const selectableClass = isSelectable ? '-selectable' : null;
-const validHighlightedClass = isValidHighlighted ? '-valid-highlighted' : null;
-const invalidHighlightedClass = isInvalidHighlighted ? '-invalid-highlighted' : null;
.jhlite-chip(class=[selectableClass, validHighlightedClass, invalidHighlightedClass])
span.jhlite-chip--title Chip title
if (isExtended)
.jhlite-chip--description Chip description
4 changes: 4 additions & 0 deletions src/main/style/atom/chip/chip.render.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends /layout

block body
include chip.code.pug
40 changes: 40 additions & 0 deletions src/main/style/token/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,43 @@ $jhlite-global-color-link-light: $jhlite-global-color-light !default;
$jhlite-global-color-link-light-hover: $jhlite-global-color-primary !default;
$jhlite-global-color-success: #480 !default;
$jhlite-global-color-error: #902 !default;
$jhlite-valid-highlight-animation: valid-highlight-animation 2s infinite;
$jhlite-invalid-highlight-animation: invalid-highlight-animation 2s infinite;
$jhlite-valid-highlight-start-color: #3ebf5a;
$jhlite-valid-highlight-end-color: $jhlite-global-color-success;
$jhlite-invalid-highlight-start-color: #bf3e3e;
$jhlite-invalid-highlight-end-color: $jhlite-global-color-error;

@keyframes valid-highlight-animation {
0% {
background-color: $jhlite-valid-highlight-start-color;
stroke: $jhlite-valid-highlight-start-color;
}

50% {
background-color: $jhlite-valid-highlight-end-color;
stroke: $jhlite-valid-highlight-end-color;
}

100% {
background-color: $jhlite-valid-highlight-start-color;
stroke: $jhlite-valid-highlight-start-color;
}
}

@keyframes invalid-highlight-animation {
0% {
background-color: $jhlite-invalid-highlight-start-color;
stroke: $jhlite-invalid-highlight-start-color;
}

50% {
background-color: $jhlite-invalid-highlight-end-color;
stroke: $jhlite-invalid-highlight-end-color;
}

100% {
background-color: $jhlite-invalid-highlight-start-color;
stroke: $jhlite-invalid-highlight-start-color;
}
}

0 comments on commit e2d2492

Please sign in to comment.