diff options
-rw-r--r-- | src/_functions.scss | 20 | ||||
-rw-r--r-- | src/index.scss | 3 | ||||
-rw-r--r-- | src/layouts/_card.scss | 12 | ||||
-rw-r--r-- | src/layouts/_container.scss | 12 | ||||
-rw-r--r-- | src/objects/_action-button.scss | 8 | ||||
-rw-r--r-- | src/objects/_avatar.scss | 89 | ||||
-rw-r--r-- | src/objects/_button.scss | 8 | ||||
-rw-r--r-- | src/objects/_checkbox.scss | 10 | ||||
-rw-r--r-- | src/objects/_radio.scss | 10 | ||||
-rw-r--r-- | src/objects/_status-indicator.scss | 33 | ||||
-rw-r--r-- | src/objects/_switch.scss | 10 | ||||
-rw-r--r-- | src/objects/_text-field.scss | 8 | ||||
-rwxr-xr-x | static/avatar.png | bin | 0 -> 61956 bytes | |||
-rw-r--r-- | tpl/index.pug | 72 | ||||
-rw-r--r-- | tpl/objects/avatar.pug | 26 | ||||
-rw-r--r-- | tpl/objects/status-indicator.pug | 8 |
16 files changed, 286 insertions, 43 deletions
diff --git a/src/_functions.scss b/src/_functions.scss index a649cc2..a11d5f4 100644 --- a/src/_functions.scss +++ b/src/_functions.scss | |||
@@ -1,19 +1,31 @@ | |||
1 | @use 'iro-sass/src/index' as iro; | 1 | @use 'iro-sass/src/index' as iro; |
2 | 2 | ||
3 | @function color($key, $tree: 'colors', $default: null, $global: false) { | 3 | @function color($key, $tree: 'colors', $default: null, $global: false) { |
4 | $new-key: iro.fn-list-prepend($key, --colors); | 4 | $key: iro.fn-list-prepend($key, --colors); |
5 | @return iro.props-get($new-key, $tree, $default, $global); | 5 | @return iro.props-get($key, $tree, $default, $global); |
6 | } | 6 | } |
7 | 7 | ||
8 | @function global-color($key, $tree: 'colors', $default: null, $global: true) { | 8 | @function global-color($key, $tree: 'colors', $default: null, $global: true) { |
9 | @return color($key, $tree, $default, $global); | 9 | @return color($key, $tree, $default, $global); |
10 | } | 10 | } |
11 | 11 | ||
12 | @function foreign-color($foreign-key, $key, $tree: 'colors', $default: null, $global: true) { | ||
13 | $key: iro.fn-list-prepend($key, --colors); | ||
14 | $key: iro.fn-list-prepend($key, $foreign-key); | ||
15 | @return iro.props-get($key, $tree, $default, $global); | ||
16 | } | ||
17 | |||
12 | @function dim($key, $tree: 'dims', $default: null, $global: false) { | 18 | @function dim($key, $tree: 'dims', $default: null, $global: false) { |
13 | $new-key: iro.fn-list-prepend($key, --dims); | 19 | $key: iro.fn-list-prepend($key, --dims); |
14 | @return iro.props-get($new-key, $tree, $default, $global); | 20 | @return iro.props-get($key, $tree, $default, $global); |
15 | } | 21 | } |
16 | 22 | ||
17 | @function global-dim($key, $tree: 'dims', $default: null, $global: true) { | 23 | @function global-dim($key, $tree: 'dims', $default: null, $global: true) { |
18 | @return dim($key, $tree, $default, $global); | 24 | @return dim($key, $tree, $default, $global); |
19 | } | 25 | } |
26 | |||
27 | @function foreign-dim($foreign-key, $key, $tree: 'dims', $default: null, $global: true) { | ||
28 | $key: iro.fn-list-prepend($key, --dims); | ||
29 | $key: iro.fn-list-prepend($key, $foreign-key); | ||
30 | @return iro.props-get($key, $tree, $default, $global); | ||
31 | } | ||
diff --git a/src/index.scss b/src/index.scss index 63124ed..813764c 100644 --- a/src/index.scss +++ b/src/index.scss | |||
@@ -4,6 +4,7 @@ | |||
4 | @import 'vars'; | 4 | @import 'vars'; |
5 | @import 'general'; | 5 | @import 'general'; |
6 | 6 | ||
7 | @import 'layouts/card'; | ||
7 | @import 'layouts/container'; | 8 | @import 'layouts/container'; |
8 | 9 | ||
9 | @import 'objects/icon'; | 10 | @import 'objects/icon'; |
@@ -16,6 +17,8 @@ | |||
16 | @import 'objects/checkbox'; | 17 | @import 'objects/checkbox'; |
17 | @import 'objects/switch'; | 18 | @import 'objects/switch'; |
18 | @import 'objects/action-button'; | 19 | @import 'objects/action-button'; |
20 | @import 'objects/status-indicator'; | ||
21 | @import 'objects/avatar'; | ||
19 | 22 | ||
20 | @import 'layouts/form'; | 23 | @import 'layouts/form'; |
21 | 24 | ||
diff --git a/src/layouts/_card.scss b/src/layouts/_card.scss index 5db1a6a..a5b9028 100644 --- a/src/layouts/_card.scss +++ b/src/layouts/_card.scss | |||
@@ -5,11 +5,11 @@ | |||
5 | @include iro.props-namespace('card') { | 5 | @include iro.props-namespace('card') { |
6 | @include iro.props-store(( | 6 | @include iro.props-store(( |
7 | --dims: ( | 7 | --dims: ( |
8 | --pad-x: iro.fn-px-to-rem(11px), | 8 | --pad-x: .6rem, |
9 | --pad-y: iro.fn-px-to-rem(8px), | 9 | --pad-y: .4rem, |
10 | --lg: ( | 10 | --lg: ( |
11 | --pad-x: iro.fn-px-to-rem(14px), | 11 | --pad-x: .9rem, |
12 | --pad-y: iro.fn-px-to-rem(11px), | 12 | --pad-y: .7rem, |
13 | ) | 13 | ) |
14 | ) | 14 | ) |
15 | ), 'dims'); | 15 | ), 'dims'); |
@@ -34,8 +34,8 @@ | |||
34 | flex: 0 0 auto; | 34 | flex: 0 0 auto; |
35 | 35 | ||
36 | @include iro.bem-modifier('main') { | 36 | @include iro.bem-modifier('main') { |
37 | flex-shrink: 1; | 37 | width: 100%; |
38 | width: 100%; | 38 | min-width: 0; |
39 | } | 39 | } |
40 | } | 40 | } |
41 | } | 41 | } |
diff --git a/src/layouts/_container.scss b/src/layouts/_container.scss index 40e8ab6..7f13a8b 100644 --- a/src/layouts/_container.scss +++ b/src/layouts/_container.scss | |||
@@ -7,8 +7,8 @@ | |||
7 | --dims: ( | 7 | --dims: ( |
8 | --content-width: iro.fn-px-to-rem(700px), | 8 | --content-width: iro.fn-px-to-rem(700px), |
9 | --sm-content-width: iro.fn-px-to-rem(360px), | 9 | --sm-content-width: iro.fn-px-to-rem(360px), |
10 | --padding-x: 3rem, | 10 | --pad-x: 3rem, |
11 | --padding-y: 3rem, | 11 | --pad-y: 3rem, |
12 | --in-page-spacing-y: fn.global-dim(--spacing --y --xl), | 12 | --in-page-spacing-y: fn.global-dim(--spacing --y --xl), |
13 | ) | 13 | ) |
14 | ), 'dims'); | 14 | ), 'dims'); |
@@ -38,13 +38,13 @@ | |||
38 | } | 38 | } |
39 | 39 | ||
40 | @include iro.bem-modifier('pad-x') { | 40 | @include iro.bem-modifier('pad-x') { |
41 | padding-right: fn.dim(--padding-x); | 41 | padding-right: fn.dim(--pad-x); |
42 | padding-left: fn.dim(--padding-x); | 42 | padding-left: fn.dim(--pad-x); |
43 | } | 43 | } |
44 | 44 | ||
45 | @include iro.bem-modifier('pad-y') { | 45 | @include iro.bem-modifier('pad-y') { |
46 | padding-top: fn.dim(--padding-y); | 46 | padding-top: fn.dim(--pad-y); |
47 | padding-bottom: fn.dim(--padding-y); | 47 | padding-bottom: fn.dim(--pad-y); |
48 | } | 48 | } |
49 | 49 | ||
50 | @include iro.bem-modifier('narrow') { | 50 | @include iro.bem-modifier('narrow') { |
diff --git a/src/objects/_action-button.scss b/src/objects/_action-button.scss index dd5cea7..86c7089 100644 --- a/src/objects/_action-button.scss +++ b/src/objects/_action-button.scss | |||
@@ -4,9 +4,9 @@ | |||
4 | @include iro.props-namespace('action-button') { | 4 | @include iro.props-namespace('action-button') { |
5 | @include iro.props-store(( | 5 | @include iro.props-store(( |
6 | --dims: ( | 6 | --dims: ( |
7 | --padding-x: .6rem, | 7 | --pad-x: .6rem, |
8 | --padding-y: .6rem, | 8 | --pad-y: .6rem, |
9 | --rounding: 3px, | 9 | --rounding: 3px, |
10 | ), | 10 | ), |
11 | ), 'dims'); | 11 | ), 'dims'); |
12 | 12 | ||
@@ -93,7 +93,7 @@ | |||
93 | 93 | ||
94 | @include iro.bem-object(iro.props-namespace()) { | 94 | @include iro.bem-object(iro.props-namespace()) { |
95 | display: inline-block; | 95 | display: inline-block; |
96 | padding: fn.dim(--padding-y) fn.dim(--padding-x); | 96 | padding: fn.dim(--pad-y) fn.dim(--pad-x); |
97 | border: 1px solid fn.color(--border); | 97 | border: 1px solid fn.color(--border); |
98 | border-radius: fn.dim(--rounding); | 98 | border-radius: fn.dim(--rounding); |
99 | background-color: fn.color(--bg); | 99 | background-color: fn.color(--bg); |
diff --git a/src/objects/_avatar.scss b/src/objects/_avatar.scss new file mode 100644 index 0000000..3bdfddc --- /dev/null +++ b/src/objects/_avatar.scss | |||
@@ -0,0 +1,89 @@ | |||
1 | @use 'iro-sass/src/index' as iro; | ||
2 | @use '../functions' as fn; | ||
3 | |||
4 | @include iro.props-namespace('avatar') { | ||
5 | @include iro.props-store(( | ||
6 | --dims: ( | ||
7 | --size: iro.fn-px-to-rem(40px), | ||
8 | --size-sm: iro.fn-px-to-rem(30px), | ||
9 | --size-xs: iro.fn-px-to-rem(20px), | ||
10 | --indicator-size: fn.foreign-dim(--status-indicator, --size), | ||
11 | --indicator-spacing: iro.fn-px-to-rem(3px), | ||
12 | --rounding: 25%, | ||
13 | ), | ||
14 | ), 'dims'); | ||
15 | |||
16 | @include iro.props-store(( | ||
17 | --colors: ( | ||
18 | --h: 354, | ||
19 | --s: 44%, | ||
20 | --l: 45%, | ||
21 | ), | ||
22 | ), 'colors'); | ||
23 | |||
24 | @include iro.bem-object(iro.props-namespace()) { | ||
25 | display: inline-block; | ||
26 | position: relative; | ||
27 | font-size: 1rem; | ||
28 | font-style: normal; | ||
29 | |||
30 | @include iro.bem-elem('status') { | ||
31 | position: absolute; | ||
32 | right: 0; | ||
33 | bottom: 0; | ||
34 | |||
35 | @include iro.bem-next-elem('content') { | ||
36 | mask-image: radial-gradient( | ||
37 | circle calc(.5 * fn.dim(--indicator-size) + fn.dim(--indicator-spacing)) at | ||
38 | calc(100% - .5 * fn.dim(--indicator-size)) | ||
39 | calc(100% - .5 * fn.dim(--indicator-size)), | ||
40 | transparent 95%, | ||
41 | #fff | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | @include iro.bem-elem('content') { | ||
47 | display: block; | ||
48 | width: fn.dim(--size); | ||
49 | height: fn.dim(--size); | ||
50 | border-radius: fn.dim(--rounding); | ||
51 | background-color: hsl(fn.color(--h), fn.color(--s), fn.color(--l)); | ||
52 | color: #fff; | ||
53 | line-height: fn.dim(--size); | ||
54 | text-align: center; | ||
55 | } | ||
56 | |||
57 | @include iro.bem-modifier('circle') { | ||
58 | @include iro.bem-elem('content') { | ||
59 | border-radius: 100%; | ||
60 | } | ||
61 | } | ||
62 | |||
63 | @include iro.bem-modifier('placeholder') { | ||
64 | @include iro.bem-elem('content') { | ||
65 | background-color: hsl(0, 0%, fn.color(--l)); | ||
66 | } | ||
67 | } | ||
68 | |||
69 | @include iro.bem-modifier('sm') { | ||
70 | font-size: iro.fn-px-to-rem(13px); | ||
71 | |||
72 | @include iro.bem-elem('content') { | ||
73 | width: fn.dim(--size-sm); | ||
74 | height: fn.dim(--size-sm); | ||
75 | line-height: fn.dim(--size-sm); | ||
76 | } | ||
77 | } | ||
78 | |||
79 | @include iro.bem-modifier('xs') { | ||
80 | font-size: iro.fn-px-to-rem(12px); | ||
81 | |||
82 | @include iro.bem-elem('content') { | ||
83 | width: fn.dim(--size-xs); | ||
84 | height: fn.dim(--size-xs); | ||
85 | line-height: fn.dim(--size-xs); | ||
86 | } | ||
87 | } | ||
88 | } | ||
89 | } | ||
diff --git a/src/objects/_button.scss b/src/objects/_button.scss index 57c49e8..f158176 100644 --- a/src/objects/_button.scss +++ b/src/objects/_button.scss | |||
@@ -35,9 +35,9 @@ | |||
35 | @include iro.props-namespace('button') { | 35 | @include iro.props-namespace('button') { |
36 | @include iro.props-store(( | 36 | @include iro.props-store(( |
37 | --dims: ( | 37 | --dims: ( |
38 | --padding-x: 1.2rem, | 38 | --pad-x: 1.2rem, |
39 | --padding-y: .5rem, | 39 | --pad-y: .5rem, |
40 | --rounding: 10em, | 40 | --rounding: 10em, |
41 | ), | 41 | ), |
42 | ), 'dims'); | 42 | ), 'dims'); |
43 | 43 | ||
@@ -114,7 +114,7 @@ | |||
114 | @include typography.set-font(vars.$font--main, (weight: 500)); | 114 | @include typography.set-font(vars.$font--main, (weight: 500)); |
115 | 115 | ||
116 | display: inline-block; | 116 | display: inline-block; |
117 | padding: fn.dim(--padding-y) fn.dim(--padding-x); | 117 | padding: fn.dim(--pad-y) fn.dim(--pad-x); |
118 | border: 2px solid transparent; | 118 | border: 2px solid transparent; |
119 | border-radius: fn.dim(--rounding); | 119 | border-radius: fn.dim(--rounding); |
120 | line-height: 1; | 120 | line-height: 1; |
diff --git a/src/objects/_checkbox.scss b/src/objects/_checkbox.scss index 377b002..3bda5e7 100644 --- a/src/objects/_checkbox.scss +++ b/src/objects/_checkbox.scss | |||
@@ -7,8 +7,8 @@ | |||
7 | --size: iro.fn-px-to-rem(14px), | 7 | --size: iro.fn-px-to-rem(14px), |
8 | --label-gap: .6rem, | 8 | --label-gap: .6rem, |
9 | --border-width: fn.global-dim(--border-width --medium), | 9 | --border-width: fn.global-dim(--border-width --medium), |
10 | --padding-x: .3rem, | 10 | --pad-x: .3rem, |
11 | --padding-y: .3rem, | 11 | --pad-y: .3rem, |
12 | --margin-right: fn.global-dim(--spacing --x --md), | 12 | --margin-right: fn.global-dim(--spacing --x --md), |
13 | ), | 13 | ), |
14 | ), 'dims'); | 14 | ), 'dims'); |
@@ -46,9 +46,9 @@ | |||
46 | display: inline-flex; | 46 | display: inline-flex; |
47 | position: relative; | 47 | position: relative; |
48 | align-items: flex-start; | 48 | align-items: flex-start; |
49 | margin-right: calc(-1 * fn.dim(--padding-x) + fn.dim(--margin-right)); | 49 | margin-right: calc(-1 * fn.dim(--pad-x) + fn.dim(--margin-right)); |
50 | margin-left: calc(-1 * fn.dim(--padding-x)); | 50 | margin-left: calc(-1 * fn.dim(--pad-x)); |
51 | padding: fn.dim(--padding-y) fn.dim(--padding-x); | 51 | padding: fn.dim(--pad-y) fn.dim(--pad-x); |
52 | 52 | ||
53 | @include iro.bem-elem('box') { | 53 | @include iro.bem-elem('box') { |
54 | display: block; | 54 | display: block; |
diff --git a/src/objects/_radio.scss b/src/objects/_radio.scss index 51bfcd8..26e8c31 100644 --- a/src/objects/_radio.scss +++ b/src/objects/_radio.scss | |||
@@ -7,8 +7,8 @@ | |||
7 | --diameter: iro.fn-px-to-rem(15px), | 7 | --diameter: iro.fn-px-to-rem(15px), |
8 | --label-gap: .6rem, | 8 | --label-gap: .6rem, |
9 | --border-width: fn.global-dim(--border-width --medium), | 9 | --border-width: fn.global-dim(--border-width --medium), |
10 | --padding-x: .3rem, | 10 | --pad-x: .3rem, |
11 | --padding-y: .3rem, | 11 | --pad-y: .3rem, |
12 | --margin-right: fn.global-dim(--spacing --x --md), | 12 | --margin-right: fn.global-dim(--spacing --x --md), |
13 | ), | 13 | ), |
14 | ), 'dims'); | 14 | ), 'dims'); |
@@ -46,9 +46,9 @@ | |||
46 | display: inline-flex; | 46 | display: inline-flex; |
47 | position: relative; | 47 | position: relative; |
48 | align-items: flex-start; | 48 | align-items: flex-start; |
49 | margin-right: calc(-1 * fn.dim(--padding-x) + fn.dim(--margin-right)); | 49 | margin-right: calc(-1 * fn.dim(--pad-x) + fn.dim(--margin-right)); |
50 | margin-left: calc(-1 * fn.dim(--padding-x)); | 50 | margin-left: calc(-1 * fn.dim(--pad-x)); |
51 | padding: fn.dim(--padding-y) fn.dim(--padding-x); | 51 | padding: fn.dim(--pad-y) fn.dim(--pad-x); |
52 | 52 | ||
53 | @include iro.bem-elem('circle') { | 53 | @include iro.bem-elem('circle') { |
54 | display: block; | 54 | display: block; |
diff --git a/src/objects/_status-indicator.scss b/src/objects/_status-indicator.scss new file mode 100644 index 0000000..18d6f81 --- /dev/null +++ b/src/objects/_status-indicator.scss | |||
@@ -0,0 +1,33 @@ | |||
1 | @use 'iro-sass/src/index' as iro; | ||
2 | @use '../functions' as fn; | ||
3 | |||
4 | @include iro.props-namespace('status-indicator') { | ||
5 | @include iro.props-store(( | ||
6 | --dims: ( | ||
7 | --size: iro.fn-px-to-rem(10px), | ||
8 | ), | ||
9 | ), 'dims'); | ||
10 | |||
11 | @include iro.props-store(( | ||
12 | --colors: ( | ||
13 | --default: fn.global-color(--obj-lo), | ||
14 | --green: scale-color(hsl(113, 49.8%, 49.6%), $lightness: 15%), | ||
15 | --yellow: scale-color(hsl(50, 59.8%, 58.4%), $lightness: 15%), | ||
16 | --red: scale-color(hsl(352, 69.8%, 58.4%), $lightness: 15%), | ||
17 | ), | ||
18 | ), 'colors'); | ||
19 | |||
20 | @include iro.bem-object(iro.props-namespace()) { | ||
21 | display: inline-block; | ||
22 | width: fn.dim(--size); | ||
23 | height: fn.dim(--size); | ||
24 | border-radius: fn.dim(--size); | ||
25 | background-color: fn.color(--default); | ||
26 | |||
27 | @each $color in 'green' 'yellow' 'red' { | ||
28 | @include iro.bem-is($color) { | ||
29 | background-color: fn.color(--#{$color}); | ||
30 | } | ||
31 | } | ||
32 | } | ||
33 | } | ||
diff --git a/src/objects/_switch.scss b/src/objects/_switch.scss index 85aa782..2d70844 100644 --- a/src/objects/_switch.scss +++ b/src/objects/_switch.scss | |||
@@ -8,8 +8,8 @@ | |||
8 | --height: iro.fn-px-to-rem(15px), | 8 | --height: iro.fn-px-to-rem(15px), |
9 | --label-gap: .6rem, | 9 | --label-gap: .6rem, |
10 | --border-width: fn.global-dim(--border-width --medium), | 10 | --border-width: fn.global-dim(--border-width --medium), |
11 | --padding-x: .3rem, | 11 | --pad-x: .3rem, |
12 | --padding-y: .3rem, | 12 | --pad-y: .3rem, |
13 | --margin-right: fn.global-dim(--spacing --x --md), | 13 | --margin-right: fn.global-dim(--spacing --x --md), |
14 | ), | 14 | ), |
15 | ), 'dims'); | 15 | ), 'dims'); |
@@ -50,9 +50,9 @@ | |||
50 | display: inline-flex; | 50 | display: inline-flex; |
51 | position: relative; | 51 | position: relative; |
52 | align-items: flex-start; | 52 | align-items: flex-start; |
53 | margin-right: calc(-1 * fn.dim(--padding-x) + fn.dim(--margin-right)); | 53 | margin-right: calc(-1 * fn.dim(--pad-x) + fn.dim(--margin-right)); |
54 | margin-left: calc(-1 * fn.dim(--padding-x)); | 54 | margin-left: calc(-1 * fn.dim(--pad-x)); |
55 | padding: fn.dim(--padding-y) fn.dim(--padding-x); | 55 | padding: fn.dim(--pad-y) fn.dim(--pad-x); |
56 | 56 | ||
57 | @include iro.bem-elem('indicator') { | 57 | @include iro.bem-elem('indicator') { |
58 | display: block; | 58 | display: block; |
diff --git a/src/objects/_text-field.scss b/src/objects/_text-field.scss index ca0eb5b..90d4b11 100644 --- a/src/objects/_text-field.scss +++ b/src/objects/_text-field.scss | |||
@@ -34,8 +34,8 @@ | |||
34 | @include iro.props-namespace('text-field') { | 34 | @include iro.props-namespace('text-field') { |
35 | @include iro.props-store(( | 35 | @include iro.props-store(( |
36 | --dims: ( | 36 | --dims: ( |
37 | --padding-x: .6rem, | 37 | --pad-x: .6rem, |
38 | --padding-y: .5rem, | 38 | --pad-y: .5rem, |
39 | --border-width: fn.global-dim(--border-width --thin), | 39 | --border-width: fn.global-dim(--border-width --thin), |
40 | --border-radius: 2px, | 40 | --border-radius: 2px, |
41 | 41 | ||
@@ -91,7 +91,7 @@ | |||
91 | @include iro.bem-object(iro.props-namespace()) { | 91 | @include iro.bem-object(iro.props-namespace()) { |
92 | position: relative; | 92 | position: relative; |
93 | min-width: 0; | 93 | min-width: 0; |
94 | padding: fn.dim(--padding-y) fn.dim(--padding-x); | 94 | padding: fn.dim(--pad-y) fn.dim(--pad-x); |
95 | background-color: fn.color(--bg); | 95 | background-color: fn.color(--bg); |
96 | 96 | ||
97 | @include iro.bem-elem('bg') { | 97 | @include iro.bem-elem('bg') { |
@@ -176,7 +176,7 @@ | |||
176 | 176 | ||
177 | @include iro.bem-elem('native') { | 177 | @include iro.bem-elem('native') { |
178 | box-sizing: border-box; | 178 | box-sizing: border-box; |
179 | padding: fn.dim(--padding-y) fn.dim(--padding-x); | 179 | padding: fn.dim(--pad-y) fn.dim(--pad-x); |
180 | } | 180 | } |
181 | } | 181 | } |
182 | 182 | ||
diff --git a/static/avatar.png b/static/avatar.png new file mode 100755 index 0000000..aa4345f --- /dev/null +++ b/static/avatar.png | |||
Binary files differ | |||
diff --git a/tpl/index.pug b/tpl/index.pug index 2980016..206e40b 100644 --- a/tpl/index.pug +++ b/tpl/index.pug | |||
@@ -13,6 +13,8 @@ include objects/checkbox.pug | |||
13 | include objects/switch.pug | 13 | include objects/switch.pug |
14 | include objects/form.pug | 14 | include objects/form.pug |
15 | include objects/action-button.pug | 15 | include objects/action-button.pug |
16 | include objects/status-indicator.pug | ||
17 | include objects/avatar.pug | ||
16 | 18 | ||
17 | mixin box | 19 | mixin box |
18 | +container(padX=true padY=true inPage=true theme="raised") | 20 | +container(padX=true padY=true inPage=true theme="raised") |
@@ -363,3 +365,73 @@ html | |||
363 | = ' ' | 365 | = ' ' |
364 | +action-button(quiet=true icon='trash' selected=true disabled=true) | 366 | +action-button(quiet=true icon='trash' selected=true disabled=true) |
365 | 367 | ||
368 | //----------------------------------------- | ||
369 | |||
370 | +h1-heading(level='xl')= 'Status indicator' | ||
371 | +rule(level='medium') | ||
372 | |||
373 | +box | ||
374 | +status-indicator | ||
375 | = ' ' | ||
376 | +status-indicator('green') | ||
377 | = ' ' | ||
378 | +status-indicator('yellow') | ||
379 | = ' ' | ||
380 | +status-indicator('red') | ||
381 | |||
382 | //----------------------------------------- | ||
383 | |||
384 | +h1-heading(level='xl')= 'Avatar' | ||
385 | +rule(level='medium') | ||
386 | |||
387 | +box | ||
388 | div(style={ display: 'flex', gap: '.3em' }) | ||
389 | +avatar | ||
390 | = 'Vo' | ||
391 | +avatar(status='green' hue=45) | ||
392 | = 'lp' | ||
393 | +avatar(src='avatar.png') | ||
394 | +avatar(src='avatar.png' status='red') | ||
395 | br | ||
396 | br | ||
397 | div(style={ display: 'flex', gap: '.3em' }) | ||
398 | +avatar(size='sm' hue=90) | ||
399 | = 'eo' | ||
400 | +avatar(size='sm' status='green' hue=135) | ||
401 | = 'n' | ||
402 | +avatar(size='sm' src='avatar.png') | ||
403 | +avatar(size='sm' src='avatar.png' status='red') | ||
404 | br | ||
405 | br | ||
406 | div(style={ display: 'flex', gap: '.3em' }) | ||
407 | +avatar(size='xs' hue=180) | ||
408 | = 'V' | ||
409 | +avatar(size='xs' hue=225) | ||
410 | = 'o' | ||
411 | +avatar(size='xs' src='avatar.png') | ||
412 | |||
413 | +box | ||
414 | div(style={ display: 'flex', gap: '.3em' }) | ||
415 | +avatar(circle=true) | ||
416 | = 'Vo' | ||
417 | +avatar(circle=true status='green' hue=45) | ||
418 | = 'lp' | ||
419 | +avatar(circle=true src='avatar.png') | ||
420 | +avatar(circle=true src='avatar.png' status='red') | ||
421 | br | ||
422 | br | ||
423 | div(style={ display: 'flex', gap: '.3em' }) | ||
424 | +avatar(circle=true size='sm' hue=90) | ||
425 | = 'eo' | ||
426 | +avatar(circle=true size='sm' status='green' hue=135) | ||
427 | = 'n' | ||
428 | +avatar(circle=true size='sm' src='avatar.png') | ||
429 | +avatar(circle=true size='sm' src='avatar.png' status='red') | ||
430 | br | ||
431 | br | ||
432 | div(style={ display: 'flex', gap: '.3em' }) | ||
433 | +avatar(circle=true size='xs' hue=180) | ||
434 | = 'V' | ||
435 | +avatar(circle=true size='xs' hue=225) | ||
436 | = 'o' | ||
437 | +avatar(circle=true size='xs' src='avatar.png') | ||
diff --git a/tpl/objects/avatar.pug b/tpl/objects/avatar.pug new file mode 100644 index 0000000..83c0f7c --- /dev/null +++ b/tpl/objects/avatar.pug | |||
@@ -0,0 +1,26 @@ | |||
1 | include ../objects/status-indicator.pug | ||
2 | |||
3 | mixin avatar | ||
4 | - | ||
5 | let classes = { | ||
6 | 'o-avatar': true, | ||
7 | 'o-avatar--circle': attributes.circle | ||
8 | } | ||
9 | |||
10 | if (attributes.size) { | ||
11 | classes['o-avatar--' + attributes.size] = true; | ||
12 | } | ||
13 | |||
14 | let styles = {} | ||
15 | if (attributes.hue) { | ||
16 | styles['--avatar--colors--h'] = attributes.hue; | ||
17 | } | ||
18 | |||
19 | div(class=classes style=styles) | ||
20 | if attributes.status | ||
21 | +status-indicator(attributes.status)(class='o-avatar__status') | ||
22 | if attributes.src | ||
23 | img.o-avatar__content(src=attributes.src) | ||
24 | else | ||
25 | .o-avatar__content | ||
26 | block | ||
diff --git a/tpl/objects/status-indicator.pug b/tpl/objects/status-indicator.pug new file mode 100644 index 0000000..9b240e1 --- /dev/null +++ b/tpl/objects/status-indicator.pug | |||
@@ -0,0 +1,8 @@ | |||
1 | mixin status-indicator(status) | ||
2 | - | ||
3 | let classes = { | ||
4 | 'o-status-indicator': true, | ||
5 | } | ||
6 | classes['is-' + status] = true | ||
7 | |||
8 | div(class=classes)&attributes(attributes) | ||