This repository was archived by the owner on Jul 19, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +66
-2
lines changed Expand file tree Collapse file tree 3 files changed +66
-2
lines changed Original file line number Diff line number Diff line change
1
+ module UI.Card exposing (..)
2
+
3
+ import Html exposing (Html , div , text )
4
+ import Html.Attributes exposing (class )
5
+
6
+
7
+ type alias Card msg =
8
+ { title : Maybe String , items : List ( Html msg) }
9
+
10
+
11
+ card : List (Html msg ) -> Card msg
12
+ card items =
13
+ { title = Nothing , items = items }
14
+
15
+
16
+ titled : String -> List (Html msg ) -> Card msg
17
+ titled title items =
18
+ { title = Just title, items = items }
19
+
20
+
21
+ withTitle : String -> Card msg -> Card msg
22
+ withTitle title card_ =
23
+ { card_ | title = Just title }
24
+
25
+
26
+ withItems : List (Html msg ) -> Card msg -> Card msg
27
+ withItems items card_ =
28
+ { card_ | items = items }
29
+
30
+
31
+ withItem : Html msg -> Card msg -> Card msg
32
+ withItem item card_ =
33
+ { card_ | items = card_. items ++ [ item ] }
34
+
35
+
36
+ view : Card msg -> Html msg
37
+ view card_ =
38
+ let
39
+ items =
40
+ case card_. title of
41
+ Just t ->
42
+ h3 [ class " card-title" ] [ text t ] :: card_. items
43
+ in
44
+ div [ class " card" ] items
Original file line number Diff line number Diff line change
1
+ .card {
2
+ padding : 1rem 1.5rem ;
3
+ display : flex;
4
+ flex-direction : column;
5
+ gap : 1rem ;
6
+ color : var (--color-card-fg );
7
+ border-radius : var (--border-radius-base );
8
+ background : var (--color-card-bg );
9
+ }
10
+
11
+ .card .card-title {
12
+ color : var (--color-card-title );
13
+ text-transform : uppercase;
14
+ font-size : var (--font-size-medium );
15
+ }
Original file line number Diff line number Diff line change 208
208
--color-button-danger-hover-fg : var (--color-gray-lighten-100 );
209
209
--color-button-danger-hover-bg : var (--color-pink-2 );
210
210
211
- /* Badges */
211
+ /* Card */
212
+ --color-card-bg : var (--color-gray-lighten-100 );
213
+ --color-card-fg : var (--color-gray-darken-30 );
214
+ --color-card-title : var (--color-gray-lighten-30 );
215
+
216
+ /* Badge */
212
217
--color-badge-fg : var (--color-gray-base );
213
218
--color-badge-bg : var (--color-gray-lighten-60 );
214
219
--color-badge-border : var (--color-gray-lighten-50 );
220
225
--color-option-badge-bg : var (--color-gray-darken-30 );
221
226
--color-option-badge-border : var (--color-transparent );
222
227
223
- /* Tooltips */
228
+ /* Tooltip */
224
229
--color-tooltip-fg : var (--color-gray-lighten-60 );
225
230
--color-tooltip-subtle-fg : var (--color-gray-lighten-20 );
226
231
--color-tooltip-bg : var (--color-gray-darken-30 );
You can’t perform that action at this time.
0 commit comments