Skip to content

Commit

Permalink
Merge pull request #5 from netwerk-digitaal-erfgoed/feature/MMF-29
Browse files Browse the repository at this point in the history
Feat: MMF-29
  • Loading branch information
aabelmann authored Aug 14, 2024
2 parents 57bf199 + cb903e4 commit 2432cee
Show file tree
Hide file tree
Showing 15 changed files with 296 additions and 78 deletions.
9 changes: 0 additions & 9 deletions nuxt/assets/icons/ndeLogo.svg

This file was deleted.

13 changes: 10 additions & 3 deletions nuxt/assets/scss/defaults.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@
--black-50: rgba(0, 0, 0, 0.5);

// Font Sizes
--font-size-sm: 0.875rem;
--font-size-xsm: 0.875rem;
--font-size-sm: 1rem;
--font-size-base: 1.25rem;
--font-size-md: 1.375rem;
--font-size-lg: 1.5rem;
--font-size-xl: 2rem;
--font-size-2xl: 2.25rem;
--font-size-3xl: 2.75rem;

@for $i from 2 through 10 {
$increment: 0.5rem;
$value: 2rem + (($i - 1) * $increment);
--font-size-#{$i}xl: #{$value};
}

// Font weights
--font-weight-light: 300;
Expand All @@ -39,6 +44,8 @@
--space-#{$i}: #{$value};
}

--container: 100rem;

// Transitions
--transition-page-vertical: top 1s;
--transition-page-horizontal: left 1s;
Expand Down
2 changes: 1 addition & 1 deletion nuxt/components/Atoms/ArtworkTeaser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ defineProps<{
}
.subtitle {
font-size: var(--font-size-sm);
font-size: var(--font-size-xsm);
font-weight: var(--font-weight-light);
}
}
Expand Down
30 changes: 26 additions & 4 deletions nuxt/components/Atoms/Button.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
<template>
<button
v-if="type !== 'link'"
:type="type"
:class="classes">
<slot></slot>
</button>
<NuxtLink
v-else
:class="classes"
:to="to">
<slot></slot>
</NuxtLink>
</template>

<script setup lang="ts">
import type { RouteLocationRaw } from '#vue-router';
const props = withDefaults(
defineProps<{
variant?: 'primary' | 'secondary';
type?: HTMLButtonElement['type'];
type?: HTMLButtonElement['type'] | 'link';
to?: RouteLocationRaw;
}>(),
{
variant: 'primary',
Expand All @@ -19,7 +29,13 @@ const props = withDefaults(
);
const classes = computed(() => {
return ['btn', props.variant];
const c = ['btn', props.variant];
if (props.type === 'link') {
c.push('link');
}
return c;
});
</script>

Expand All @@ -31,6 +47,10 @@ const classes = computed(() => {
transition: var(--transition-state);
user-select: none;
&.link {
display: inline-block;
}
&:disabled {
cursor: not-allowed;
}
Expand All @@ -40,7 +60,8 @@ const classes = computed(() => {
border: var(--space-0) solid transparent;
background-color: var(--blues-blue);
&:hover:enabled {
&:hover:enabled,
&.link:hover {
color: var(--blues-blue);
background-color: var(--background-color);
border: var(--space-0) solid var(--blues-blue);
Expand All @@ -52,7 +73,8 @@ const classes = computed(() => {
color: var(--blues-blue);
border: var(--space-0) solid var(--blues-blue);
&:hover:enabled {
&:hover:enabled,
&.link:hover {
background-color: var(--blues-blue);
color: var(--background-color);
border: var(--space-0) solid transparent;
Expand Down
30 changes: 30 additions & 0 deletions nuxt/components/Atoms/Logo.vue

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion nuxt/components/Atoms/PropertyGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const properties = computed(() => {
<style scoped lang="scss">
.property {
@include flex-column;
font-size: var(--font-size-sm);
font-size: var(--font-size-xsm);
font-weight: var(--font-weight-light);
.label {
Expand Down
2 changes: 1 addition & 1 deletion nuxt/components/Molecules/Branding/Intro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const introClass = computed(() => {
}
.footer {
font-size: var(--font-size-sm);
font-size: var(--font-size-xsm);
text-transform: uppercase;
grid-row-start: 3;
grid-column: span 8 / span 8;
Expand Down
24 changes: 23 additions & 1 deletion nuxt/components/Molecules/Header.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<template>
<div :class="{ base: true, 'dark-mode': darkMode }">
<div
ref="header"
:class="{ base: true, 'dark-mode': darkMode }">
<MoleculesButtonsHome v-if="showHome" />
<h3
v-if="title"
Expand Down Expand Up @@ -27,6 +29,26 @@ withDefaults(
showHome: true,
},
);
const header = ref<HTMLDivElement>();
const cleanup = () => {
document.body.style.removeProperty('--header-height');
};
const setHeaderHeight = () => {
if (header.value) {
document.body.style.setProperty('--header-height', header.value.getBoundingClientRect().height + 'px');
}
return cleanup;
};
useResize(setHeaderHeight);
onMounted(() => {
setHeaderHeight();
});
</script>

<style scoped lang="scss">
Expand Down
2 changes: 1 addition & 1 deletion nuxt/components/organisms/ArtworkSlider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const { findByCategory } = artworkStore;
border: 1px solid black;
text-transform: unset;
padding: var(--space-2);
font-size: var(--font-size-sm);
font-size: var(--font-size-xsm);
font-weight: var(--font-weight-light);
}
}
Expand Down
26 changes: 26 additions & 0 deletions nuxt/composables/useResize.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export function useResize(fn: (event: Event) => void | (() => void), target: Window | Element | Ref<Element | undefined> = window) {
let cleanup: (() => void) | undefined;

const listener = (event: Event) => {
const result = fn(event);

if (result) {
cleanup = result;
}
};

onMounted(() => {
unref(target)?.addEventListener('resize', listener);
});

const removeListener = () => {
unref(target)?.removeEventListener('resize', listener);
};

onBeforeUnmount(() => {
cleanup?.();
removeListener();
});

return removeListener;
}
29 changes: 18 additions & 11 deletions nuxt/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,31 @@ import svgLoader from 'vite-svg-loader';

// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
ssr: false,
devtools: {
enabled: false,
},
css: [
'ress/ress.css',
'@/assets/scss/defaults.scss',
'@/assets/scss/theme.scss',
'@/assets/scss/main.scss',
'@/assets/scss/transitions.scss',
],
modules: ['@pinia/nuxt'],
devtools: {
enabled: false,
},
googleFonts: {
families: {
Poppins: true,
},
download: false,
useStylesheet: true,
},
modules: ['@pinia/nuxt', '@nuxtjs/google-fonts'],
runtimeConfig: {
app: {
backendUrl: '',
token: '',
},
},
ssr: false,
vite: {
plugins: [svgLoader()],
css: {
Expand All @@ -24,12 +37,6 @@ export default defineNuxtConfig({
},
},
},
runtimeConfig: {
app: {
backendUrl: '',
token: '',
},
},
vue: {
compilerOptions: {
isCustomElement: tag => tag.startsWith('swiper-'),
Expand Down
26 changes: 26 additions & 0 deletions nuxt/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"devDependencies": {
"@nuxtjs/eslint-config-typescript": "^12.1.0",
"@nuxtjs/google-fonts": "^3.2.0",
"@types/node": "^20.12.12",
"@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.10.0",
Expand Down
2 changes: 1 addition & 1 deletion nuxt/pages/[flix]/[category]/[artwork].vue
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ if (currentArtwork && currentCategory) {
margin-right: 0;
.description-content {
font-size: var(--font-size-sm);
font-size: var(--font-size-xsm);
font-weight: var(--font-weight-light);
margin-top: var(--space-4);
}
Expand Down
Loading

0 comments on commit 2432cee

Please sign in to comment.