Skip to content

Commit 99a49b0

Browse files
committed
refactor: move elements from Main
1 parent b5925f6 commit 99a49b0

File tree

3 files changed

+269
-212
lines changed

3 files changed

+269
-212
lines changed

src/CombinatorsAnimated.elm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ combinatorStyled shiftX =
243243
, left (pct shiftX)
244244
, color Theme.color.primary
245245
, Theme.fontFamily.secondary
246-
, Theme.breakpoint.tablet [ Theme.textSize.normal ]
246+
, Theme.breakpoint.tablet [ Theme.textSize.medium ]
247247
]
248248

249249

@@ -287,6 +287,5 @@ combinatorsBackground model =
287287
{ combinators } =
288288
model
289289
in
290-
-- todo: "ul"
291290
combinatorsContainer
292291
(List.map combinatorKeyed combinators)

src/Elements.elm

Lines changed: 225 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import Svg.Styled.Attributes as SAttr
1111

1212

1313

14-
-- LAMBDA LOGO --
14+
-------------------------------------------------------------------------------
15+
-- LAMBDA LOGOS
16+
-------------------------------------------------------------------------------
1517

1618

1719
animFill =
@@ -60,7 +62,7 @@ lambdaPath =
6062
]
6163
)
6264
, Css.property "stroke-dasharray" "1000"
63-
, Css.property "animation-duration" "2s"
65+
, Css.animationDuration (sec 2)
6466
, Css.property "animation-timing-function" "ease-in-out"
6567
, Css.property "stroke" Theme.colorRaw.primary
6668
, Css.property "stroke-width" "2px"
@@ -96,7 +98,9 @@ lambdaLogoSmall =
9698

9799

98100

101+
-------------------------------------------------------------------------------
99102
-- Common Elements
103+
-------------------------------------------------------------------------------
100104

101105

102106
boxStyled =
@@ -162,6 +166,20 @@ headerTitle size txt =
162166
[ text txt ]
163167

164168

169+
headerTitleXLarge =
170+
headerTitle XLarge
171+
172+
173+
headerTitleLarge =
174+
headerTitle Large
175+
176+
177+
type alias LinkData =
178+
{ url : String
179+
, label : String
180+
}
181+
182+
165183
link themeColor { url, label } =
166184
a
167185
[ href url
@@ -184,6 +202,12 @@ linkText =
184202
link Theme.color.text
185203

186204

205+
206+
-------------------------------------------------------------------------------
207+
-- ICONS
208+
-------------------------------------------------------------------------------
209+
210+
187211
icon srcIcon =
188212
img
189213
[ src srcIcon
@@ -209,55 +233,140 @@ navigationIcon =
209233
icon "assets/navigation-feather-icon.svg"
210234

211235

236+
237+
-------------------------------------------------------------------------------
238+
-- HOME ELEMENTS
239+
-------------------------------------------------------------------------------
240+
241+
242+
type alias ContentHome =
243+
{ title : String
244+
, groupLink : LinkData
245+
, textInvite : String
246+
, description : String
247+
}
248+
249+
250+
animaWidth =
251+
Anima.property "width"
252+
253+
254+
lambdaSeparator =
255+
div
256+
[ css
257+
[ Css.maxWidth (px 120)
258+
, backgroundColor Theme.color.primary
259+
, borderColor Theme.color.primary
260+
, borderWidth (px 1)
261+
, borderStyle solid
262+
, Css.height (px 6)
263+
, Css.width (pct 100)
264+
, margin3 (rem 1.5) (rem 0) (rem 3)
265+
, animationName
266+
(Anima.keyframes
267+
[ ( 0, [ animaWidth "0%", Anima.backgroundColor Theme.color.background ] )
268+
, ( 80, [ animaWidth "30%", Anima.backgroundColor Theme.color.background ] )
269+
, ( 100, [ animaWidth "100%", Anima.backgroundColor Theme.color.primary ] )
270+
]
271+
)
272+
, Css.animationDuration (sec 2)
273+
, Css.property "animation-timing-function" "ease-in-out"
274+
, Theme.breakpoint.tablet [ Css.height (px 4), Css.maxWidth (px 60) ]
275+
]
276+
]
277+
[]
278+
279+
280+
homeParagraphStyled =
281+
styled textStyled
282+
[ Theme.textSize.large
283+
, textAlign center
284+
, Theme.breakpoint.tablet [ Theme.textSize.medium ]
285+
]
286+
287+
288+
lambdaDescription contents =
289+
boxStyled
290+
[ css
291+
[ padding (rem 4)
292+
, backgroundColor Theme.color.backgroundAlpha
293+
, Theme.breakpoint.tablet [ padding (rem 1) ]
294+
]
295+
]
296+
[ homeParagraphStyled []
297+
[ text contents.description ]
298+
, homeParagraphStyled []
299+
[ text contents.textInvite
300+
, linkDefault contents.groupLink
301+
, text "."
302+
]
303+
]
304+
305+
306+
homeContent : ContentHome -> Html msg
307+
homeContent contents =
308+
div
309+
[ css
310+
[ displayFlex
311+
, justifyContent center
312+
, flexDirection column
313+
, alignItems center
314+
, padding3 (rem 6) (rem 0) (rem 0)
315+
, maxWidth (px 720)
316+
, boxSizing borderBox
317+
, margin auto
318+
, zIndex (int 2)
319+
, position relative
320+
, Theme.breakpoint.tablet [ maxWidth (px 520) ]
321+
]
322+
]
323+
[ lambdaLogoLarge
324+
, headerTitleXLarge contents.title
325+
, lambdaSeparator
326+
, lambdaDescription contents
327+
]
328+
329+
330+
331+
-------------------------------------------------------------------------------
332+
-- REPOSITORY ELEMENTS
333+
-------------------------------------------------------------------------------
334+
335+
212336
repositoryRow repoLinkData =
213337
div
214338
[ css
215-
-- TODO: use the Styles
216339
[ displayFlex
217340
, padding2 (rem 1) (rem 0)
218341
, alignItems center
219342
]
220343
]
221344
[ div
222345
[ css
223-
-- TODO: Refactor Icon element
224-
-- TODO: use the StyleGuide
225-
-- TODO: add an interaction here
226346
[ paddingRight (rem 3)
227-
, withMedia
228-
[ only screen [ Media.maxWidth (px 800) ] ]
229-
[ paddingRight (rem 1.5) ]
347+
, Theme.breakpoint.tablet [ paddingRight (rem 1.5) ]
230348
]
231349
]
232350
[ githubIcon ]
233351
, div []
234-
-- TODO: transform the link* in a styled element
235352
[ spanStyled
236353
[ css
237354
[ Theme.textSize.large
238-
, Theme.breakpoint.tablet
239-
[ Theme.textSize.medium ]
355+
, Theme.breakpoint.tablet [ Theme.textSize.medium ]
240356
]
241357
]
242358
[ linkText repoLinkData ]
243359
]
244360
]
245361

246362

247-
248-
-- TODO: split this element, plz
249-
250-
251363
repositoryContainer { title, content } =
252364
div
253365
[ css
254366
[ padding2 (rem 4) (rem 0)
255-
, withMedia
256-
[ only screen [ Media.maxWidth (px 800) ] ]
257-
[ Css.maxWidth (pct 100) ]
367+
, Theme.breakpoint.tablet [ Css.maxWidth (pct 100) ]
258368
]
259369
]
260-
-- TODO: add an interation here
261370
[ boxStyled
262371
[ css
263372
[ display inlineBlock
@@ -290,6 +399,23 @@ repositoryContainer { title, content } =
290399
]
291400

292401

402+
repositoriesSection repositories =
403+
section
404+
[ css
405+
[ displayFlex
406+
, flexWrap Css.wrap
407+
, justifyContent spaceAround
408+
]
409+
]
410+
(List.map repositoryContainer repositories)
411+
412+
413+
414+
-------------------------------------------------------------------------------
415+
-- LANGUAGES ELEMENTS
416+
-------------------------------------------------------------------------------
417+
418+
293419
languageWrapper ({ label, rot, url } as lang) =
294420
let
295421
( tx, ty ) =
@@ -311,3 +437,82 @@ languageWrapper ({ label, rot, url } as lang) =
311437
]
312438
]
313439
[ linkDefault { label = label, url = url } ]
440+
441+
442+
languageContainer languages =
443+
div
444+
[ css
445+
[ minWidth (px 240)
446+
, maxWidth (px 720)
447+
, minHeight (rem 8)
448+
, displayFlex
449+
, Theme.breakpoint.tablet [ minHeight (rem 6) ]
450+
, flex (int 1)
451+
, justifyContent spaceBetween
452+
]
453+
]
454+
(List.map languageWrapper languages)
455+
456+
457+
languagesSection languagesTuple =
458+
section
459+
[ css
460+
[ displayFlex
461+
, padding2 (rem 12) (rem 2)
462+
, maxWidth (px 1440)
463+
, overflow Css.hidden
464+
, flexWrap Css.wrap
465+
, Css.width (pct 100)
466+
, Theme.breakpoint.tablet [ padding2 (rem 2) (rem 1) ]
467+
]
468+
]
469+
[ div [ css [ padding4 (rem 0) (rem 3) (rem 0) (rem 1) ] ] [ lambdaLogoSmall ]
470+
, languageContainer (Tuple.first languagesTuple)
471+
, languageContainer (Tuple.second languagesTuple)
472+
]
473+
474+
475+
476+
-------------------------------------------------------------------------------
477+
-- FOOTER ELEMENTS
478+
-------------------------------------------------------------------------------
479+
480+
481+
footerLink data =
482+
div [ css [ displayFlex, padding3 (rem 2) (rem 1) (rem 0) ] ]
483+
[ data.icon
484+
, div [ css [ paddingLeft (rem 1.5) ] ]
485+
[ spanStyled
486+
[ css
487+
[ Theme.textSize.large
488+
, Theme.breakpoint.tablet [ Theme.textSize.medium ]
489+
]
490+
]
491+
[ linkText data.link ]
492+
]
493+
]
494+
495+
496+
footerSection linksData title =
497+
footer
498+
[ css
499+
[ -- TODO: create some styles for flex*
500+
displayFlex
501+
, flexDirection column
502+
, alignItems center
503+
, justifyContent center
504+
, padding2 (rem 3) (rem 0)
505+
, backgroundColor Theme.color.footer
506+
]
507+
]
508+
-- Split this elements
509+
[ div [ css [ displayFlex ] ]
510+
[ lambdaLogoMedium
511+
, div [ css [ paddingLeft (rem 2) ] ] [ headerTitleLarge title ]
512+
]
513+
, div [ css [ displayFlex, justifyContent spaceAround ] ]
514+
(List.map
515+
footerLink
516+
linksData
517+
)
518+
]

0 commit comments

Comments
 (0)