-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/formation section #468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
6efe803
8b8244b
b688373
985e6f3
4729b1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "openscript-ch-website": patch | ||
| --- | ||
|
|
||
| Add formation page |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| --- | ||
| type Props = { | ||
| elements: { | ||
| text: string; | ||
| title: string; | ||
| }[]; | ||
| shortSpine?: boolean; | ||
| }; | ||
|
|
||
| const { elements, shortSpine = false } = Astro.props; | ||
|
|
||
| const spineHeight = shortSpine ? "100%" : "calc(100% + var(--size-height-divider) + (2 * var(--size-gutter-massive)))"; | ||
| const displayTriangle = shortSpine ? "none" : "absolute"; | ||
| --- | ||
|
|
||
| <div class="timeline"> | ||
| <ol> | ||
| { | ||
| elements.map((element) => ( | ||
| <li> | ||
| <h6>{element.title}</h6> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we shouldn't use
I suggest to use a |
||
| <p>{element.text}</p> | ||
| </li> | ||
| )) | ||
| } | ||
| </ol> | ||
| </div> | ||
|
|
||
| <style define:vars={{ spineHeight, displayTriangle }}> | ||
| .timeline { | ||
| position: relative; | ||
| } | ||
|
|
||
| h6 { | ||
| margin-top: 0; | ||
| } | ||
|
|
||
| p { | ||
| font-size: 15px; | ||
| } | ||
|
|
||
| ol { | ||
| list-style: none; | ||
| margin: 0; | ||
| padding: 0; | ||
|
|
||
| display: flex; | ||
| flex-direction: column; | ||
| gap: var(--timeline-gap); | ||
| } | ||
|
|
||
| /* spine of the timeline */ | ||
| .timeline::before { | ||
| content: ""; | ||
| width: 4px; | ||
| height: var(--spineHeight); | ||
| position: absolute; | ||
| left: 50%; | ||
| transform: translateX(-50%); | ||
| background-color: var(--color-primary); | ||
| z-index: 3; /* above potential dividers */ | ||
| } | ||
|
|
||
| li { | ||
| display: flex; | ||
| flex-direction: column; | ||
| box-sizing: border-box; | ||
| padding: 1rem; | ||
| background: var(--color-overlay); | ||
| width: 45%; | ||
| box-shadow: 0px 15px 30px -15px rgba(0, 0, 0, 0.5); | ||
| } | ||
|
|
||
| li::after { | ||
| content: ""; | ||
| width: 20px; | ||
| height: 20px; | ||
| border-radius: 50%; | ||
| border-width: 4px; | ||
| border-style: solid; | ||
| border-color: var(--color-primary); | ||
| background: var(--color-white); | ||
| position: absolute; | ||
| left: 50%; | ||
| transform: translateX(-50%); | ||
| z-index: 5; /* above spine */ | ||
| } | ||
|
|
||
| @media screen and (min-width: 1025px) { | ||
| ol li:nth-child(even) { | ||
| align-self: flex-end; | ||
| } | ||
| } | ||
|
|
||
| @media screen and (max-width: 1025px) { | ||
| li::after { | ||
| left: 90%; | ||
| } | ||
|
|
||
| .timeline::before { | ||
| left: 90%; | ||
| } | ||
|
|
||
| .timeline::after { | ||
| content: ""; | ||
| width: 20px; | ||
| aspect-ratio: 1; | ||
| clip-path: polygon(0 0, 50% 100%, 100% 0); | ||
| background-color: var(--color-primary); | ||
| left: calc(90% - 10px); | ||
| bottom: calc(-1 * (5px + var(--size-height-divider) + (2 * var(--size-gutter-massive)))); | ||
| position: var(--displayTriangle); | ||
| z-index: 3; /* above potential dividers */ | ||
| } | ||
|
|
||
| li { | ||
| width: 85%; | ||
| } | ||
|
|
||
| li:not(:last-child) { | ||
| margin-bottom: 4rem; | ||
| } | ||
| } | ||
| </style> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| items: | ||
| de: | ||
| - title: Lorem | ||
| text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
| - title: Lorem | ||
| text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
| - title: Lorem | ||
| text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
| en: | ||
| - title: Lorem | ||
| text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
| - title: Lorem | ||
| text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
| - title: Lorem | ||
| text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| items: | ||
| de: | ||
| - title: Web-Domain | ||
| text: Bereits am 24. April 2007 wurde die Domain openscript.ch registriert. | ||
| - title: Handelsregistereintrag | ||
| text: Seit dem 23. Januar 2020 sind wir im Handelsregister eingetragen. | ||
| en: | ||
| - title: Web Domain | ||
| text: The domain openscript.ch was already registered on April 24, 2007. | ||
| - title: Commercial Register Entry | ||
| text: We have been registered in the commercial register since January 23, 2020. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| items: | ||
| de: | ||
| - title: Lorem | ||
| text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
| - title: Lorem | ||
| text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
| - title: Lorem | ||
| text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
| en: | ||
| - title: Lorem | ||
| text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
| - title: Lorem | ||
| text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
| - title: Lorem | ||
| text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,49 @@ | ||||||||||||||||
| --- | ||||||||||||||||
| import { currentLocale } from "astro-nanostores-i18n:runtime"; | ||||||||||||||||
| import Timeline from "../../components/Timeline.astro"; | ||||||||||||||||
| import { getCollection } from "astro:content"; | ||||||||||||||||
|
|
||||||||||||||||
| type Props = { | ||||||||||||||||
| key: string; | ||||||||||||||||
| class?: string; | ||||||||||||||||
| last?: boolean; | ||||||||||||||||
| }; | ||||||||||||||||
|
|
||||||||||||||||
| const { key, class: className, last } = Astro.props; | ||||||||||||||||
|
|
||||||||||||||||
| const locale = currentLocale.get(); | ||||||||||||||||
|
|
||||||||||||||||
| const timelineCollection = await getCollection("formation", (entry) => entry.data.locale === locale); | ||||||||||||||||
|
|
||||||||||||||||
| const formationData = timelineCollection | ||||||||||||||||
| .filter((t) => t.id.includes(key)) | ||||||||||||||||
| .flatMap((t) => { | ||||||||||||||||
| if (Array.isArray(t.data.items)) { | ||||||||||||||||
| return t.data.items.map((item) => ({ ...item })); | ||||||||||||||||
| } | ||||||||||||||||
| return []; | ||||||||||||||||
| }); | ||||||||||||||||
| --- | ||||||||||||||||
|
|
||||||||||||||||
| <section class:list={[className]}> | ||||||||||||||||
| <div> | ||||||||||||||||
| <slot name="title" /> | ||||||||||||||||
| <slot /> | ||||||||||||||||
| </div> | ||||||||||||||||
|
Comment on lines
+29
to
+32
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The additional slot doesn't seem to be necessary.
Suggested change
|
||||||||||||||||
| <Timeline elements={formationData} shortSpine={last} /> | ||||||||||||||||
| </section> | ||||||||||||||||
|
|
||||||||||||||||
| <style> | ||||||||||||||||
| section { | ||||||||||||||||
| display: grid; | ||||||||||||||||
| column-gap: 1.5rem; | ||||||||||||||||
| grid-template-columns: 60% 40%; | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| @media screen and (max-width: 1025px) { | ||||||||||||||||
| section { | ||||||||||||||||
| grid-template-columns: 100%; | ||||||||||||||||
| row-gap: 1rem; | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
| </style> | ||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For more flexibility, maybe we should add a
<TimelineEntry>component and use it here via<slot>. For example I already wish to add a date or year, but I would have to change the props of the Timeline component.