Skip to content

Commit d9402dc

Browse files
authored
Merge pull request #603 from openscript-ch/feat/references-page
Feat/references page
2 parents 8312837 + d409ca4 commit d9402dc

60 files changed

Lines changed: 1232 additions & 195 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.changeset/brown-foxes-join.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'openscript-ch-website': patch
3+
---
4+
5+
Add references page

‎astro.config.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,7 @@ export default defineConfig({
6262
mdx(),
6363
sitemap({ i18n: { defaultLocale: C.DEFAULT_LOCALE, locales: C.LOCALES } }),
6464
],
65+
image: {
66+
responsiveStyles: true,
67+
},
6568
});

‎src/components/Button.astro‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
---
2+
import { resolveSimplePath } from '../utils/paths';
23
import Sprite from './Sprite.astro';
4+
import { currentLocale } from 'astro-nanostores-i18n:runtime';
35
46
type Props = {
57
href: string;
68
withArrow?: boolean;
9+
resolvePath?: boolean;
10+
navigationSpace?: 'main' | 'footer';
711
};
812
9-
const { href, withArrow } = Astro.props;
13+
const { href, resolvePath = false, navigationSpace = 'main', withArrow } = Astro.props;
14+
15+
let path;
16+
17+
if (resolvePath) {
18+
const locale = currentLocale.get();
19+
path = await resolveSimplePath(navigationSpace, href, locale);
20+
}
1021
---
1122

12-
<a href={href} class="button">
23+
<a href={path ?? href} class="button">
1324
<slot />
1425
{withArrow && <Sprite name="arrow" />}
1526
</a>

‎src/components/Tile.astro‎

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
---
2+
type Props = {
3+
id: string;
4+
variant: 'default' | 'turnable';
5+
crease?: boolean;
6+
color?: 'white' | 'beige';
7+
};
8+
9+
const { id, variant, color = 'white', crease = false }: Props = Astro.props;
10+
---
11+
12+
<turnable-tile
13+
{id}
14+
class:list={['tile', color]}
15+
data-crease={crease}
16+
data-id={id}
17+
data-variant={variant}
18+
>
19+
<div class="tile-front">
20+
<slot name="front" />
21+
</div>
22+
{variant === 'turnable' && (
23+
<div class="tile-back">
24+
<slot name="back" />
25+
</div>
26+
)}
27+
</turnable-tile>
28+
29+
<style>
30+
.tile {
31+
color: inherit;
32+
font-weight: 600;
33+
display: grid;
34+
grid-template-areas: 'stack';
35+
position: relative;
36+
perspective: 1000px;
37+
transform-style: preserve-3d;
38+
transition: rotate 500ms linear;
39+
}
40+
41+
.tile[data-variant='turnable'] {
42+
cursor: pointer;
43+
}
44+
45+
.tile.show {
46+
rotate: y 180deg;
47+
}
48+
49+
.tile-front,
50+
.tile-back {
51+
grid-area: stack;
52+
padding: var(--size-gutter);
53+
display: grid;
54+
place-content: center;
55+
backface-visibility: hidden;
56+
text-align: center;
57+
height: 100%;
58+
box-sizing: border-box;
59+
}
60+
61+
.white .tile-front,
62+
.white .tile-back {
63+
background-color: var(--color-white);
64+
}
65+
66+
.beige .tile-front,
67+
.beige .tile-back {
68+
background-color: var(--color-background);
69+
}
70+
71+
.tile-back {
72+
rotate: y 180deg;
73+
}
74+
75+
.tile-front {
76+
grid-area: stack;
77+
padding: var(--size-gutter-medium);
78+
display: grid;
79+
place-content: center;
80+
backface-visibility: hidden;
81+
text-align: center;
82+
height: 100%;
83+
box-sizing: border-box;
84+
}
85+
86+
.tile[data-crease='true'] .tile-front {
87+
clip-path: polygon(0 0, 100% 0, 100% calc(100% - 13px), calc(100% - 13px) 100%, 0 100%);
88+
}
89+
90+
.tile[data-crease='true'] .tile-front::after {
91+
content: '';
92+
position: absolute;
93+
bottom: 0;
94+
right: 0;
95+
width: 0;
96+
height: 0;
97+
98+
border-style: solid;
99+
border-width: 13px 13px 0 0;
100+
border-color: #d0d0d0 transparent transparent transparent;
101+
}
102+
</style>
103+
104+
<script>
105+
class Tile extends HTMLElement {
106+
connectedCallback() {
107+
const id = this.dataset.id;
108+
if (!id) return;
109+
110+
const tile = document.getElementById(id);
111+
112+
tile?.addEventListener('click', function () {
113+
if (tile?.dataset.variant === 'turnable') {
114+
tile?.classList.toggle('show');
115+
}
116+
});
117+
}
118+
}
119+
120+
if (!customElements.get('turnable-tile')) {
121+
customElements.define('turnable-tile', Tile);
122+
}
123+
</script>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
import type { AccordionItem } from '../../types/AccordionItem';
3+
4+
/**
5+
* Accordion Component
6+
*
7+
* @description A fully accessible accordion component that follows WAI-ARIA guidelines
8+
*/
9+
10+
interface Props {
11+
/**
12+
* Additional classes to apply to the accordion container
13+
*/
14+
class?: string;
15+
/**
16+
* Accordion items to render
17+
*/
18+
children: AccordionItem | AccordionItem[];
19+
/**
20+
* HTML attributes to spread on the accordion
21+
*/
22+
[key: string]: string | number | boolean | undefined | AccordionItem | AccordionItem[];
23+
}
24+
25+
const { class: className, ...rest } = Astro.props;
26+
---
27+
28+
<ul class:list={['accordion', className]} {...rest}>
29+
<slot />
30+
</ul>
31+
32+
<style>
33+
:where(.accordion) {
34+
display: flex;
35+
flex-direction: column;
36+
gap: 0;
37+
padding: 0;
38+
list-style: none;
39+
}
40+
41+
:global(:where(.accordion > .item:first-child .wrapper)) {
42+
border-block-start: none !important;
43+
}
44+
</style>

0 commit comments

Comments
 (0)