Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/brown-foxes-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'openscript-ch-website': patch
---

Add references page
3 changes: 3 additions & 0 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@ export default defineConfig({
mdx(),
sitemap({ i18n: { defaultLocale: C.DEFAULT_LOCALE, locales: C.LOCALES } }),
],
image: {
responsiveStyles: true,
},
});
15 changes: 13 additions & 2 deletions src/components/Button.astro
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
---
import { resolveSimplePath } from '../utils/paths';
import Sprite from './Sprite.astro';
import { currentLocale } from 'astro-nanostores-i18n:runtime';

type Props = {
href: string;
withArrow?: boolean;
resolvePath?: boolean;
navigationSpace?: 'main' | 'footer';
};

const { href, withArrow } = Astro.props;
const { href, resolvePath = false, navigationSpace = 'main', withArrow } = Astro.props;

let path;

if (resolvePath) {
const locale = currentLocale.get();
path = await resolveSimplePath(navigationSpace, href, locale);
}
---

<a href={href} class="button">
<a href={path ?? href} class="button">
<slot />
{withArrow && <Sprite name="arrow" />}
</a>
Expand Down
123 changes: 123 additions & 0 deletions src/components/Tile.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---
type Props = {
id: string;
variant: 'default' | 'turnable';
crease?: boolean;
color?: 'white' | 'beige';
};

const { id, variant, color = 'white', crease = false }: Props = Astro.props;
---

<turnable-tile
{id}
class:list={['tile', color]}
data-crease={crease}
data-id={id}
data-variant={variant}
>
<div class="tile-front">
<slot name="front" />
</div>
{variant === 'turnable' && (
<div class="tile-back">
<slot name="back" />
</div>
)}
</turnable-tile>

<style>
.tile {
color: inherit;
font-weight: 600;
display: grid;
grid-template-areas: 'stack';
position: relative;
perspective: 1000px;
transform-style: preserve-3d;
transition: rotate 500ms linear;
}

.tile[data-variant='turnable'] {
cursor: pointer;
}

.tile.show {
rotate: y 180deg;
}

.tile-front,
.tile-back {
grid-area: stack;
padding: var(--size-gutter);
display: grid;
place-content: center;
backface-visibility: hidden;
text-align: center;
height: 100%;
box-sizing: border-box;
}

.white .tile-front,
.white .tile-back {
background-color: var(--color-white);
}

.beige .tile-front,
.beige .tile-back {
background-color: var(--color-background);
}

.tile-back {
rotate: y 180deg;
}

.tile-front {
grid-area: stack;
padding: var(--size-gutter-medium);
display: grid;
place-content: center;
backface-visibility: hidden;
text-align: center;
height: 100%;
box-sizing: border-box;
}

.tile[data-crease='true'] .tile-front {
clip-path: polygon(0 0, 100% 0, 100% calc(100% - 13px), calc(100% - 13px) 100%, 0 100%);
}

.tile[data-crease='true'] .tile-front::after {
content: '';
position: absolute;
bottom: 0;
right: 0;
width: 0;
height: 0;

border-style: solid;
border-width: 13px 13px 0 0;
border-color: #d0d0d0 transparent transparent transparent;
}
</style>

<script>
class Tile extends HTMLElement {
connectedCallback() {
const id = this.dataset.id;
if (!id) return;

const tile = document.getElementById(id);

tile?.addEventListener('click', function () {
if (tile?.dataset.variant === 'turnable') {
tile?.classList.toggle('show');
}
});
}
}

if (!customElements.get('turnable-tile')) {
customElements.define('turnable-tile', Tile);
}
</script>
44 changes: 44 additions & 0 deletions src/components/accordion/Accordion.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
import type { AccordionItem } from '../../types/AccordionItem';

/**
* Accordion Component
*
* @description A fully accessible accordion component that follows WAI-ARIA guidelines
*/

interface Props {
/**
* Additional classes to apply to the accordion container
*/
class?: string;
/**
* Accordion items to render
*/
children: AccordionItem | AccordionItem[];
/**
* HTML attributes to spread on the accordion
*/
[key: string]: string | number | boolean | undefined | AccordionItem | AccordionItem[];
}

const { class: className, ...rest } = Astro.props;
---

<ul class:list={['accordion', className]} {...rest}>
<slot />
</ul>

<style>
:where(.accordion) {
display: flex;
flex-direction: column;
gap: 0;
padding: 0;
list-style: none;
}

:global(:where(.accordion > .item:first-child .wrapper)) {
border-block-start: none !important;
}
</style>
Loading
Loading