-
Notifications
You must be signed in to change notification settings - Fork 49
/
Master.elm
971 lines (889 loc) · 38.9 KB
/
Master.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
module Visual.Master exposing (..)
import Color
import Element exposing (..)
import Element.Attributes exposing (..)
import Element.Events as Events
import Element.Keyed
import Html
import Html.Attributes
import Style exposing (..)
import Style.Background as Background
import Style.Border as Border
import Style.Color as Color
import Style.Font as Font
import Style.Shadow as Shadow
import Style.Sheet
import Style.Transition as Transition
(=>) =
(,)
type Styles
= None
| Main
| Page
| Box
| Container
| Label
| Blue
| BlackText
| Crazy Other
| Sub SubStyle
type SubStyle
= SubStyle
type Other
= Thing Int
options =
[ Style.unguarded
]
stylesheet : StyleSheet Styles variation
stylesheet =
Style.styleSheet
[ style None []
, style Main
[ Border.all 1
, Color.text Color.darkCharcoal
, Color.background Color.white
, Color.border Color.lightGrey
, Font.typeface [ Font.font "helvetica", Font.font "arial", Font.sansSerif ]
, Font.size 16
-- , Font.lineHeight 1.2
]
, style Page
[ Border.rounded 5
, Border.all 5
, Border.solid
, Color.text Color.darkCharcoal
, Color.background Color.white
, Color.border Color.lightGrey
]
, style Label
[ Font.size 25
, Font.center
]
, style Blue
[ Color.text Color.white
, Color.background Color.blue
, Font.center
]
, style BlackText
[ Color.text Color.black
]
, style Box
[ Transition.all
, Color.text Color.white
, Color.background Color.blue
, Color.border Color.blue
, Border.rounded 3
, hover
[ Color.text Color.white
, Color.background Color.red
, Color.border Color.red
, cursor "pointer"
]
]
, style Container
[ Color.text Color.black
, Color.background Color.lightGrey
, Color.border Color.lightGrey
, hover
[ Color.background Color.grey
, Color.border Color.grey
, cursor "pointer"
]
]
, style
(Crazy
(Thing 5)
)
[]
, subSheet
|> Style.Sheet.map Sub identity
|> Style.Sheet.merge
]
subSheet =
[ style SubStyle
[ Color.text Color.white
, Color.background Color.blue
]
]
-- testForm =
-- [ Element.form <|
-- column
-- Box
-- [ spacingXY 10 20 ]
-- [ checkbox True None [] (text "Yes, Lunch pls.")
-- , label None [] (text "check this out") <|
-- inputText None [] "The Value!"
-- , label None [] (text "check this out") <|
-- textArea None [] "The Value!"
-- , radio "lunch"
-- None
-- []
-- [ option "burrito" True (text "A Burrito!")
-- , option "taco" False (text " A Taco!")
-- ]
-- , select "favorite-animal"
-- None
-- []
-- [ option "manatee" False (text "Manatees are pretty cool")
-- , option "pangolin" False (text "But so are pangolins")
-- , option "bee" True (text "Bees")
-- ]
-- ]
-- ]
main =
Html.program
{ init = ( 0, Cmd.none )
, update = update
, view = view
, subscriptions = \_ -> Sub.none
}
type Msg
= Ping
update msg model =
case msg of
Ping ->
let
_ =
Debug.log "ping" "pong"
in
( model, Cmd.none )
box =
el Box [ width (px 200), height (px 200) ] empty
miniBox =
el Box [ width (px 20), height (px 20) ] empty
view model =
Element.layout stylesheet <|
el None [ center, width (px 800) ] <|
column Main
[ spacingXY 50 100 ]
(List.concat
[ basics
, invisibleText
, anchoredWithContent
, anchoredNoContent
, anchoredLayoutWithContent
, anchoredAboveLayout
, viewTextLayout
, [ otherTextLayout ]
, [ embeddedStyledHtml ]
, overflowIssue
, [ overFlowIssue2 ]
, viewRowLayouts
, [ verticalCenterText ]
, viewColumnLayouts
, viewTable
, viewGridLayout
, viewNamedGridLayout
-- -- , testForm
-- , [ screenExample
-- , screenExample2
-- ]
]
)
otherTextLayout =
textLayout Container
[ spacing 10, paddingXY 10 10 ]
[ el None [] <| text "A basic element is only allowed to have one child because it doesn't specify how children should be organized in a layout."
, paragraph None
[]
[ el None [] <| text "We also have a style identifier here, "
, el Box [ padding 0 ] (text "MyStyle")
, el None [] <| text ", which we'll get into in the Style section of this guide."
]
]
screenExample =
screen <|
el None [ width (percent 100), alignBottom ] <|
row Container
[ spread
, width (percent 60)
, paddingXY 30 4
]
[ el Box [ padding 8, width (px 200) ] (text "test")
, el Box [ padding 8, width (px 200) ] (text "test")
|> above
[ column Container
[ moveUp 22, moveRight 20, spacing 8, alignRight ]
[ el Box [ width (px 85), height (px 30), padding 8 ] (text "AAAA")
, el Box [ width (px 85), height (px 30), padding 8 ] (text "BBBB")
, el Box [ width (px 85), height (px 30), padding 8 ] (text "CCCC")
]
]
]
screenExample2 =
screen <|
el Box [ padding 8, width (px 200), alignRight ] (text "test")
basics =
[ el Container [ paddingXY 20 5 ] (text "Single Element")
, el Container [ moveRight 20, moveDown 20, paddingXY 20 5 ] (text "Single Element")
, el Container [ paddingLeft 20, paddingRight 5 ] (text "Single Element")
, el Container [ paddingXY 20 5, alignLeft ] (text "Single Element")
, el Container [ paddingXY 20 5, center, width (px 200) ] (text "Centered Element")
, el Container [ paddingXY 20 5, alignRight ] (text "Align Right")
, el Container [ paddingXY 20 5, center, spacingXY 20 20, width (px 200) ] (text "Centered ++ 20/20 Spacing Element")
, el Container [ paddingXY 20 5, center, spacingXY 20 20, width content, height content ] (text "Centered ++ 20/20 Spacing Element (width/height content)")
, el Container [ paddingXY 20 5, center, width (percent 100) ] (text "Single Element")
, mapAll identity Sub identity <|
el SubStyle [ paddingXY 20 5 ] (text "Sub Style!")
]
anchoredNoContent =
[ row None
[ spacingXY 150 150
, center
]
[ column None
[ spacingXY 20 60 ]
[ el Label [ width (px 200) ] (text "Anchored (no content)")
, el Container [ width (px 200), height (px 200) ] empty
|> within
[ el Box [ width (px 10), height (px 10), alignTop, alignRight ] empty
, el Box [ width (px 10), height (px 10), alignTop, alignLeft ] empty
, el Box [ width (px 10), height (px 10), alignBottom, alignRight ] empty
, el Box [ width (px 10), height (px 10), alignBottom, alignLeft ] empty
, el Box [ width (px 10), height (px 10), alignTop, center ] empty
, el Box [ width (px 10), height (px 10), alignBottom, center ] empty
, el Box [ width (px 10), height (px 10), verticalCenter, center ] empty
, el Box [ width (px 10), height (px 10), verticalCenter, alignRight ] empty
, el Box [ width (px 10), height (px 10), verticalCenter, alignLeft ] empty
]
]
, column
None
[ spacingXY 20 60 ]
[ section Label [ width (px 200) ] (text "Nearby (no content)")
, el Container [ width (px 200), height (px 200) ] empty
|> above
[ el Box [ width (px 10), height (px 10) ] empty
, el Box [ width (px 10), height (px 10), alignRight ] empty
, el Box [ width (px 10), height (px 10), center ] empty
]
|> below
[ el Box [ width (px 10), height (px 10) ] empty
, el Box [ width (px 10), height (px 10), alignRight ] empty
, el Box [ width (px 10), height (px 10), center ] empty
]
|> onRight
[ el Box [ width (px 10), height (px 10) ] empty
, el Box [ width (px 10), height (px 10), alignBottom ] empty
, el Box [ width (px 10), height (px 10), verticalCenter ] empty
]
|> onLeft
[ el Box [ width (px 10), height (px 10) ] empty
, el Box [ width (px 10), height (px 10), alignBottom ] empty
, el Box [ width (px 10), height (px 10), verticalCenter ] empty
]
]
]
, row None
[ spacingXY 150 150
, center
]
[ column None
[ spacingXY 20 60 ]
[ el Label [ width (px 200) ] (text "Move 20/20 (no content)")
, el Container [ width (px 200), height (px 200) ] empty
|> within
[ el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, alignTop, alignRight ] empty
, el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, alignTop, alignLeft ] empty
, el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, alignBottom, alignRight ] empty
, el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, alignBottom, alignLeft ] empty
, el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, alignTop, center ] empty
, el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, alignBottom, center ] empty
, el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, verticalCenter, center ] empty
, el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, verticalCenter, alignRight ] empty
, el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, verticalCenter, alignLeft ] empty
]
]
, column None
[ spacingXY 20 60 ]
[ el Label [ width (px 200) ] (text "Move 20 20 (no content)")
, el Container [ width (px 200), height (px 200) ] empty
|> above
[ el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20 ] empty
, el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, alignRight ] empty
, el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, center ] empty
]
|> below
[ el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20 ] empty
, el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, alignRight ] empty
, el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, center ] empty
]
|> onRight
[ el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20 ] empty
, el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, alignBottom ] empty
, el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, verticalCenter ] empty
]
|> onLeft
[ el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20 ] empty
, el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, alignBottom ] empty
, el Box [ width (px 10), height (px 10), moveRight 20, moveDown 20, verticalCenter ] empty
]
]
]
]
anchoredWithContent =
[ row None
[ spacingXY 150 150
, center
]
[ column None
[ spacingXY 20 60 ]
[ el Label [] (text "Anchored Elements")
, el Container [ width (px 200), height (px 200) ] (text "Hi!")
|> within
[ el Box [ alignTop, alignRight ] (text "Hi!")
, el Box [ alignTop, alignLeft ] (text "Hi!")
, el Box [ alignBottom, alignRight ] (text "Hi!")
, el Box [ alignBottom, alignLeft ] (text "Hi!")
, el Box [ alignTop, center ] (text "Hi!")
, el Box [ alignBottom, center ] (text "Hi!")
, el Box [ verticalCenter, center ] (text "Hi!")
, el Box [ verticalCenter, alignRight ] (text "Hi!")
, el Box [ verticalCenter, alignLeft ] (text "Hi!")
]
]
, article None [] <|
column
None
[ spacingXY 20 60 ]
[ section Label [] (text "Nearby Elements")
, el Container [ width (px 200), height (px 200) ] (text "Hi!")
|> above
[ el Box [] (text "Hi!")
, el Box [ alignRight ] (text "Hi!")
, el Box [ center ] (text "Hi!")
]
|> below
[ el Box [] (text "H!")
, el Box [ alignRight ] (text "Hi!")
, el Box [ center ] (text "Hi!")
]
|> onRight
[ el Box [] (text "Hi!")
, el Box [ alignBottom ] (text "Hi!")
, el Box [ verticalCenter ] (text "Hi!")
]
|> onLeft
[ el Box [] (text "Hi!")
, el Box [ alignBottom ] (text "Hi!")
, el Box [ verticalCenter ] (text "Hi!")
]
]
]
, row None
[ spacingXY 150 150
, center
]
[ column None
[ spacingXY 20 60 ]
[ el Label [] (text "Move 20 20")
, el Container [ width (px 200), height (px 200) ] (text "Hi!")
|> within
[ el Box [ moveRight 20, moveDown 20, alignTop, alignRight ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, alignTop, alignLeft ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, alignBottom, alignRight ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, alignBottom, alignLeft ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, alignTop, center ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, alignBottom, center ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, verticalCenter, center ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, verticalCenter, alignRight ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, verticalCenter, alignLeft ] (text "Hi!")
]
]
, column None
[ spacingXY 20 60 ]
[ el Label [] (text "Move 20 20")
, el Container [ width (px 200), height (px 200) ] (text "Hi!")
|> above
[ el Box [ moveRight 20, moveDown 20 ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, alignRight ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, center ] (text "Hi!")
]
|> below
[ el Box [ moveRight 20, moveDown 20 ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, alignRight ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, center ] (text "Hi!")
]
|> onRight
[ el Box [ moveRight 20, moveDown 20 ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, alignBottom ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, verticalCenter ] (text "Hi!")
]
|> onLeft
[ el Box [ moveRight 20, moveDown 20 ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, alignBottom ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, verticalCenter ] (text "Hi!")
]
]
]
]
anchoredLayoutWithContent =
[ row None
[ spacingXY 150 150
, center
]
[ column
None
[ spacingXY 20 60 ]
[ section Label [] (text "Nearby Layouts")
, el Container [ width (px 200), height (px 200) ] (text "Hi!")
|> above
[ row Container [ moveDown -20, spacing 10, alignRight, width fill ] [ el Box [] (text "Hi!"), el Box [] (text "Hi!") ]
]
|> below
[ row Container [ moveDown 20, spacing 10, width fill ] [ el Box [] (text "Hi!"), el Box [] (text "Hi!") ]
]
|> onRight
[ column Container [ moveRight 20, spacing 10, alignBottom, height fill ] [ el Box [] (text "Hi!"), el Box [] (text "Hi!") ]
]
|> onLeft
[ column Container [ moveRight -20, spacing 10, height fill ] [ el Box [] (text "Hi!"), el Box [] (text "Hi!") ]
]
]
, column
None
[ spacingXY 20 60 ]
[ section Label [] (text "Nearby Layouts (Within)")
, el Container [ width (px 200), height (px 200) ] (text "Hi!")
|> within
[ el None [ alignRight ] <| row Container [ spacing 10, width fill ] [ el Box [] (text "Hi!"), el Box [] (text "Hi!") ]
, el None [ alignBottom ] <| row Container [ spacing 10, alignBottom, height fill ] [ el Box [] (text "Hi!"), el Box [] (text "Hi!") ]
, el None [ alignRight, alignBottom ] <| column Container [ spacing 10, alignRight, alignBottom, width fill, height fill ] [ el Box [] (text "Hi!"), el Box [] (text "Hi!") ]
, el None [ alignLeft ] <|
column Container
[ spacing 10
, alignLeft
]
[ el Box [] (text "Hi!"), el Box [] (text "Hi!") ]
]
]
]
]
anchoredAboveLayout =
[ row None
[ center
, spacing 150
]
[ column
None
[ spacing 20 ]
[ section Label [] (text "Above Layout")
, el None [ center ] <|
(row Container [ spacing 10, padding 30, width (px 200), height (px 200) ] [ el Box [] (text "Hi!"), el Box [] (text "Hi!") ]
|> above
[ el Box [ moveRight 20, moveDown 20 ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, alignRight ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, center ] (text "Hi!")
]
|> below
[ el Box [ moveRight 20, moveDown 20 ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, alignRight ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, center ] (text "Hi!")
]
|> onRight
[ el Box [ moveRight 20, moveDown 20 ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, alignBottom ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, verticalCenter ] (text "Hi!")
]
|> onLeft
[ el Box [ moveRight 20, moveDown 20 ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, alignBottom ] (text "Hi!")
, el Box [ moveRight 20, moveDown 20, verticalCenter ] (text "Hi!")
]
)
]
, column
None
[ spacing 20 ]
[ section Label [] (text "Raw Html Below")
, el Container [ width (px 200), height (px 200) ] (text "Hi!")
|> below
[ html <| Html.div [] [ Html.text "This is raw HTML! (Should be Below" ]
]
]
]
]
viewTextLayout =
[ el Label [] (text "Text Layout")
, textLayout Page
[ padding 50
, spacingXY 25 25
]
[ el Box
[ width (px 200)
, height (px 300)
, alignLeft
]
empty
, paragraph None
[]
[ text "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vel lectus eget lorem lobortis suscipit. Fusce porta auctor purus sed tempor. Mauris auctor sapien sit amet elementum egestas. Maecenas placerat consequat mauris, at dapibus enim tristique a. Quisque feugiat ultricies lorem nec volutpat. Sed risus enim, facilisis id fermentum quis, eleifend in diam. Suspendisse euismod, urna nec consectetur volutpat, massa libero aliquam urna, hendrerit venenatis leo lacus faucibus nulla. Curabitur et mattis dolor."
]
, hairline Container
, paragraph None
[]
[ text "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vel lectus eget lorem lobortis suscipit. Fusce porta auctor purus sed tempor. Mauris auctor sapien sit amet elementum egestas. Maecenas placerat consequat mauris, at dapibus enim tristique a. Quisque feugiat ultricies lorem nec volutpat. Sed risus enim, facilisis id fermentum quis, eleifend in diam. Suspendisse euismod, urna nec consectetur volutpat, massa libero aliquam urna, hendrerit venenatis leo lacus faucibus nulla. Curabitur et mattis dolor."
]
, paragraph None
[ width (px 500)
, center
]
[ text "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vel lectus eget lorem lobortis suscipit. Fusce porta auctor purus sed tempor. Mauris auctor sapien sit amet elementum egestas. Maecenas placerat consequat mauris, at dapibus enim tristique a. Quisque feugiat ultricies lorem nec volutpat. Sed risus enim, facilisis id fermentum quis, eleifend in diam. Suspendisse euismod, urna nec consectetur volutpat, massa libero aliquam urna, hendrerit venenatis leo lacus faucibus nulla. Curabitur et mattis dolor."
]
, paragraph None
[]
[ text "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vel lectus eget lorem lobortis suscipit. Fusce porta auctor purus sed tempor. Mauris auctor sapien sit amet elementum egestas. Maecenas placerat consequat mauris, at dapibus enim tristique a. Quisque feugiat ultricies lorem nec volutpat. Sed risus enim, facilisis id fermentum quis, eleifend in diam. Suspendisse euismod, urna nec consectetur volutpat, massa libero aliquam urna, hendrerit venenatis leo lacus faucibus nulla. Curabitur et mattis dolor."
]
, el Box
[ width (px 200)
, height (px 300)
, alignRight
, spacing 100
]
empty
, paragraph None
[]
[ text "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vel lectus eget lorem lobortis suscipit. Fusce porta auctor purus sed tempor. Mauris auctor sapien sit amet elementum egestas. Maecenas placerat consequat mauris, at dapibus enim tristique a. Quisque feugiat ultricies lorem nec volutpat. Sed risus enim, facilisis id fermentum quis, eleifend in diam. Suspendisse euismod, urna nec consectetur volutpat, massa libero aliquam urna, hendrerit venenatis leo lacus faucibus nulla. Curabitur et mattis dolor."
]
, paragraph None
[ spacing 10 ]
[ el Box [ paddingXY 5 0 ] (text "•")
, el Box [ paddingXY 5 0 ] (text "•")
, el Box [ paddingXY 5 0 ] (text "•")
, text "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vel lectus eget lorem lobortis suscipit. Fusce porta auctor purus sed tempor. Mauris auctor sapien sit amet elementum egestas. Maecenas placerat consequat mauris, at dapibus enim tristique a. Quisque feugiat ultricies lorem nec volutpat. Sed risus enim, facilisis id fermentum quis, eleifend in diam. Suspendisse euismod, urna nec consectetur volutpat, massa libero aliquam urna, hendrerit venenatis leo lacus faucibus nulla. Curabitur et mattis dolor."
]
, paragraph None
[ spacing 10 ]
[ el Box [ paddingXY 5 0 ] (text "•")
, el Box [ paddingXY 5 0 ] (text "•")
, el Box [ paddingXY 5 0, spacing 0 ] (text "•")
, text "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vel lectus eget lorem lobortis suscipit. Fusce porta auctor purus sed tempor. Mauris auctor sapien sit amet elementum egestas. Maecenas placerat consequat mauris, at dapibus enim tristique a. Quisque feugiat ultricies lorem nec volutpat. Sed risus enim, facilisis id fermentum quis, eleifend in diam. Suspendisse euismod, urna nec consectetur volutpat, massa libero aliquam urna, hendrerit venenatis leo lacus faucibus nulla. Curabitur et mattis dolor."
]
-- , numbered None
-- []
-- [ text "the first"
-- , text "the second"
-- , text "afterwards"
-- ]
, paragraph None
[]
[ text "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vel lectus eget lorem lobortis suscipit. Fusce porta auctor purus sed tempor. Mauris auctor sapien sit amet elementum egestas. Maecenas placerat consequat mauris, at dapibus enim tristique a. Quisque feugiat ultricies lorem nec volutpat. Sed risus enim, facilisis id fermentum quis, eleifend in diam. Suspendisse euismod, urna nec consectetur volutpat, massa libero aliquam urna, hendrerit venenatis leo lacus faucibus nulla. Curabitur et mattis dolor."
]
, full Box [] <|
paragraph None
[]
[ text "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vel lectus eget lorem lobortis suscipit. Fusce porta auctor purus sed tempor. Mauris auctor sapien sit amet elementum egestas. Maecenas placerat consequat mauris, at dapibus enim tristique a. Quisque feugiat ultricies lorem nec volutpat. Sed risus enim, facilisis id fermentum quis, eleifend in diam. Suspendisse euismod, urna nec consectetur volutpat, massa libero aliquam urna, hendrerit venenatis leo lacus faucibus nulla. Curabitur et mattis dolor."
]
]
]
invisibleText =
[ row Container
[]
[ el None [] (text "Test! (Should be visible)") ]
, column Main
[ width <| percent 60
--, center
]
[ text "Test! (Should be visible 2)"
]
]
overflowIssue =
let
long =
"something very long too long to fit on a mobile screen and should break lorem ipsum dolar sit amet lorem ipsum lorem ipsum dolar sit amet lorem ipsum lorem ipsum dolar sit amet lorem ipsum lorem ipsum dolar sit amet lorem ipsum "
in
[ el Label [] (text "No overflow")
, row Container
[]
[ el None [] (text long) ]
, row Container
[ width (px 800) ]
[ el None [] (text long) ]
, row Container
[ width (percent 100) ]
[ el None [] (text long) ]
, row Container
[ width fill ]
[ el None [] (text long) ]
, el Label [] (text "Overflow on purpose")
, row Container
[]
[ el None [ width (px 1800) ] (text long)
]
, row Container
[ width fill ]
[ el None [ width (percent 120) ] (text long) ]
, row Container
[ width fill ]
[ el None [ width (fillPortion 2) ] (text long) ]
]
viewRowLayouts =
[ el Label [] (text "Row Layout")
, row Container
[ spacing 20 ]
[ box
, box
, box
]
, el Label [] (text "Row with Text Layout (should be centered and spaced with 20px)")
, row Container
[ spacing 20, center ]
[ text "box"
, text "box"
, text "box"
]
, el Label [] (text "Row with uneven content and fill widths (should match up)")
, column Container
[ spacing 20 ]
[ row Container
[]
[ el Box [ width fill ] (text ".")
, el Box [ width fill ] (text "short")
]
, row Container
[]
[ el Box [ width fill ] (text "short")
, el Box [ width fill ] (text "looooooooong")
]
]
, el Label [] (text "Row Child Alignment")
, row Container
[ spacingXY 20 20, height (px 400) ]
[ el Box [ width (px 100), height (px 100), alignTop ] (text "top")
, el Box [ width (px 100), height (px 100), verticalCenter ] (text "vcenter")
, el Box [ width (px 100), height (px 100), alignBottom ] (text "bottom")
, el Box [ width (px 100), height (px 100), alignRight ] (text "right (no effect)")
, el Box [ width (px 100), height (px 100), alignLeft ] (text "left (no effect)")
, el Box [ width (px 100), height (px 100), center ] (text "center (no effect)")
]
, el Label [] (text "Row Center Alignment")
, row Container
[ spacingXY 20 20, center ]
[ el Box [ width (px 100), height (px 100) ] empty
, el Box [ width (px 100), height (px 100) ] empty
, el Box [ width (px 100), height (px 100) ] empty
]
, el Label [] (text "Row Width/Heights")
, row Container
[ spacingXY 20 20, height (px 300) ]
[ el Box [ width (px 200), height fill ] (text "fill height")
, el Box [ width fill, height (px 200) ] (text "fill width")
]
, el Label [] (text "Row Center ++ Spacing")
, row Container
[ center, spacingXY 20 20 ]
[ el Box [ width (px 100), height (px 100) ] empty
, el Box [ width (px 100), height (px 100) ] empty
, full Box [ width (px 100) ] (text "full element")
]
, el Label [] (text "Row Center ++ Spacing ++ padding")
, row Container
[ center, spacingXY 20 20, padding 50 ]
[ el Box [ width (px 100), height (px 100) ] empty
, el Box [ width (px 100), height (px 100) ] empty
, full Box [ width (px 100) ] (text "full element")
]
, el Label [] (text "Wrapped Row Layout")
, wrappedRow Container
[ spacingXY 20 20 ]
[ el Box [ width (px 100), height (px 50) ] empty
, el Box [ width (px 20), height (px 50) ] empty
, el Box [ width (px 200), height (px 50) ] empty
, el Box [ width (px 120), height (px 50) ] empty
, el Box [ width (px 10), height (px 50) ] empty
, el Box [ width (px 100), height (px 50) ] empty
, el Box [ width (px 180), height (px 50) ] empty
, el Box [ width (px 20), height (px 50) ] empty
, el Box [ width (px 25), height (px 50) ] empty
]
]
viewColumnLayouts =
[ el Label [] (text "Column Layout")
, column Container
[ spacingXY 20 20 ]
[ box
, box
, box
]
, el Label [] (text "Column Layout, Justified")
, column Container
[ verticalSpread, height (px 800) ]
[ box
, box
, box
]
, el Label [] (text "Column ++ Spacing")
, column Container
[ spacingXY 20 20 ]
[ el Box [ width (px 200), height (px 200) ] empty
, el Box [ width (percent 100), height (px 200) ] (text "100% width")
, el Box [ width (px 200), height (px 200) ] empty
, full Box [ height (px 200) ] (text "full element")
, el Box [ width (px 200), height (px 200) ] empty
, full Box [ height (px 200) ] (text "full element")
]
, el Label [] (text "Column ++ Spacing ++ Padding ++ Varying widths")
, column Container
[ spacingXY 20 20, padding 50 ]
[ el Box [ width (px 200), height (px 200) ] (text "200px")
, el Box [ width (percent 100), height (px 200) ] (text "100% width")
, el Box [ width (px 200), height (px 200) ] (text "200px")
, full Box [ height (px 200) ] (text "full element")
]
, el Label [] (text "Column Alignments")
, column Container
[ spacingXY 20 20 ]
[ el Box [ width (px 200), height (px 200), alignLeft ] empty
, el Box [ width (px 200), height (px 200), center ] empty
, el Box [ width (px 200), height (px 200), alignRight ] empty
, el Box [ width (px 200), height (px 200), alignTop ] (text "No effect on purpose!")
, el Box [ width (px 200), height (px 200), alignBottom ] (text "No effect on purpose!")
, el Box [ width (px 200), height (px 200), verticalCenter ] (text "No effect on purpose!")
]
, el Label [] (text "Column Alignments ++ Width fill")
, column Container
[ spacingXY 20 20 ]
[ el Box [ width fill, height (px 200), alignLeft ] empty
, el Box [ width fill, height (px 200), center ] empty
, el Box [ width fill, height (px 200), alignRight ] empty
, el Box [ width fill, height (px 200), alignTop ] empty
, el Box [ width fill, height (px 200), alignBottom ] empty
, el Box [ width fill, height (px 200), verticalCenter ] empty
]
, el Label [] (text "Column Alignments ++ Height fill")
, column Container
[ spacingXY 20 20 ]
[ el Box [ width (px 200), height fill, alignLeft ] empty
, el Box [ width (px 200), height fill, center ] empty
, el Box [ width (px 200), height fill, alignRight ] empty
, el Box [ width (px 200), height fill, alignTop ] empty
, el Box [ width (px 200), height fill, alignBottom ] empty
, el Box [ width (px 200), height fill, verticalCenter ] empty
]
]
viewGridLayout =
[ el Label [] (text "Grid Layout")
, grid Container
[ spacing 20 ]
{ columns = [ px 100, px 100, px 100, px 100 ]
, rows =
[ px 100
, px 100
, px 100
, px 100
]
, cells =
[ cell
{ start = ( 0, 0 )
, width = 1
, height = 1
, content = el Box [] (text "box")
}
, cell
{ start = ( 1, 1 )
, width = 1
, height = 2
, content = el Box [ spacing 100 ] (text "box")
}
, cell
{ start = ( 2, 1 )
, width = 2
, height = 2
, content = el Box [] (text "box")
}
, cell
{ start = ( 1, 0 )
, width = 1
, height = 1
, content = el Box [] (text "box")
}
]
}
]
viewTable =
[ el Label [] (text "Table Layout")
, table Container
[ spacing 20 ]
[ [ el Box [] (text "box")
, el Box [ spacing 100 ] (text "box")
, el Box [] (text "box")
]
, [ el Box [] (text "reallly big box here is all the content, woohooo!!")
, el Box [ spacing 100 ] (text "box")
, el Box [] (text "box")
]
, [ el Box [ spacing 100 ] (text "box")
, el Box [] (text "reallly big box here is all the content, woohooo!!")
, el Box [] (text "box")
]
]
]
viewNamedGridLayout =
[ el Label [] (text "Named Grid Layout")
, namedGrid Container
[]
{ columns = [ px 200, px 200, px 200, fill ]
, rows =
[ px 200 => [ spanAll "header" ]
, px 200 => [ span 3 "content", span 1 "sidebar" ]
, px 200 => [ span 3 "content", span 1 "sidebar" ]
, px 200 => [ spanAll "footer" ]
]
, cells =
[ named "header"
(el Box [] (text "box"))
, named "sidebar"
(el Box [] (text "box"))
]
}
]
viewTransforms =
[ el Label [] (text "Transformations")
, row Container
[ spacingXY 20 20 ]
[ el Box
[ width (px 200)
, height fill
]
empty
]
]
{- OVERFLOW ISSUE -}
overFlowIssue2 =
let
followingMessage =
row Box
[ padding 10, width (px 200) ]
[ el BlackText [ width (percent 100) ] (text lorem)
]
lorem =
"Donec interdum elementum aliquam. Maecenas cursus sem tellus, id elementum elit condimentum eget. Proin quis massa mi. In fermentum risus at quam tristique vestibulum. Quisque convallis odio in sodales euismod. Maecenas convallis nec justo nec facilisis."
in
column Container
[ spacing 10, height <| px 800 ]
[ followingMessage
, followingMessage
, followingMessage
, followingMessage
, followingMessage
, followingMessage
]
{- Vertical Center text if height is set.
-}
verticalCenterText =
row Container
[ center, height (px 300), spacing 10 ]
[ el Box [] (text "normal")
, el Box [ height (px 100), verticalCenter ] <|
(el None [ verticalCenter ] <| text "vertical centered in box")
, el Box [] (text "normal")
]
embeddedStyledHtml =
el None [] <|
html <|
Html.div []
[ Html.node "style" [] [ Html.text ".test-style{font-family: fantasy; font-size: 80px;}" ]
, Html.text "Hello!"
, Html.b [] [ Html.text "This should be bold" ]
, Html.span [ Html.Attributes.class "test-style" ] [ Html.text "Fantasy Text!" ]
]