Skip to content

Commit

Permalink
Add logic to horizontally align items in the layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobefu committed May 10, 2024
1 parent dc84c94 commit 6c3069b
Show file tree
Hide file tree
Showing 12 changed files with 7,708 additions and 9,065 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"require": {
"composer/installers": "^2.0",
"cweagans/composer-patches": "~1.0",
"dobefu/nuxtify_profile": "^1.0@beta",
"dobefu/nuxtify_profile": "^1.0.x-dev",
"drupal/core-composer-scaffold": "^10.2",
"drupal/core-recommended": "^10"
},
Expand Down
62 changes: 32 additions & 30 deletions composer.lock

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

26 changes: 16 additions & 10 deletions frontend/base/components/global/ParagraphImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const props = defineProps({
type: Object as PropType<MediaImage>,
required: true,
},
align: {
type: String as PropType<'left' | 'right' | 'center'>,
default: 'left',
},
})
const nonce = useNonce()
Expand All @@ -14,14 +18,16 @@ const aspect = computed(() => props.image.mediaImage.width / props.image.mediaIm
</script>

<template>
<div>
<NuxtImg
:src="image.mediaImage.url"
:alt="image.mediaImage.alt ?? ''"
:width="Math.min(image.mediaImage.width, Math.ceil(1200))"
:height="Math.min(image.mediaImage.height, Math.ceil(1200 / aspect))"
:nonce="nonce"
loading="lazy"
/>
</div>
<NuxtImg
:class="{
'ms-auto': align === 'right',
'mx-auto': align === 'center',
}"
:src="image.mediaImage.url"
:alt="image.mediaImage.alt ?? ''"
:width="Math.min(image.mediaImage.width, Math.ceil(1200))"
:height="Math.min(image.mediaImage.height, Math.ceil(1200 / aspect))"
:nonce="nonce"
loading="lazy"
/>
</template>
12 changes: 11 additions & 1 deletion frontend/base/components/global/ParagraphSubtitle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@ defineProps({
type: String,
required: true,
},
align: {
type: String as PropType<'left' | 'right' | 'center'>,
default: 'left',
},
})
</script>

<template>
<h3 class="text-2xl">
<h3
class="text-2xl"
:class="{
'text-end': align === 'right',
'text-center': align === 'center',
}"
>
{{ title }}
</h3>
</template>
12 changes: 11 additions & 1 deletion frontend/base/components/global/ParagraphTitle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@ defineProps({
type: String,
required: true,
},
align: {
type: String as PropType<'left' | 'right' | 'center'>,
default: 'left',
},
})
</script>

<template>
<h2 class="text-3xl">
<h2
class="text-3xl"
:class="{
'text-end': align === 'right',
'text-center': align === 'center',
}"
>
{{ title }}
</h2>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fragment paragraphImage on ParagraphImage {
}
}
}
align
composition {
position {
parentId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
fragment paragraphSubtitle on ParagraphSubtitle {
__typename
title
align
composition {
position {
parentId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
fragment paragraphTitle on ParagraphTitle {
__typename
title
align
composition {
position {
parentId
Expand Down
Loading

0 comments on commit 6c3069b

Please sign in to comment.