-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: oivan-plenty <oana.ivan@plentysystems.com> Co-authored-by: aoltean-plenty <alexandru.oltean@plentysystems.com> Co-authored-by: Kevin Stederoth <43753494+ksted@users.noreply.github.com>
- Loading branch information
1 parent
49c381a
commit 600cced
Showing
11 changed files
with
177 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<template> | ||
<div :class="['w-full', 'space-y-4', textAlignmentClass]"> | ||
<div v-if="text?.pretitle" class="text-xl font-bold mb-2">{{ text.pretitle }}</div> | ||
<h2 v-if="text?.title" class="text-2xl font-semibold mb-4">{{ text.title }}</h2> | ||
<div v-if="text?.subtitle" class="text-lg font-semibold">{{ text.subtitle }}</div> | ||
<div v-if="text?.htmlDescription" class="text-base" v-html="text.htmlDescription" /> | ||
<UiButton | ||
v-if="button?.label && button?.link" | ||
:tag="NuxtLink" | ||
:to="localePath(button?.link ?? '')" | ||
:variant="button?.variant ?? 'primary'" | ||
class="mt-3 px-4 py-2" | ||
> | ||
{{ button?.label }} | ||
</UiButton> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { defineProps, computed } from 'vue'; | ||
import type { TextContentProps } from '~/components/TextContent/types'; | ||
const props = defineProps<TextContentProps>(); | ||
const localePath = useLocalePath(); | ||
const NuxtLink = resolveComponent('NuxtLink'); | ||
const textAlignmentClass = computed(() => { | ||
switch (props.text?.textAlignment) { | ||
case 'center': | ||
return 'text-center items-center'; | ||
case 'right': | ||
return 'text-right items-end'; | ||
default: | ||
return 'text-left items-start'; | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export type TextContentProps = { | ||
text?: { | ||
pretitle?: string; | ||
title?: string; | ||
subtitle?: string; | ||
htmlDescription?: string; | ||
textAlignment?: 'left' | 'center' | 'right'; | ||
}; | ||
button?: { | ||
label?: string; | ||
link?: string; | ||
variant?: 'primary' | 'secondary'; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<template> | ||
<div :class="['flex flex-col md:flex-row items-center', positionClass]"> | ||
<div :class="['md:w-1/2']"> | ||
<NuxtImg | ||
:src="getImageUrl()" | ||
:alt="props.image?.alt" | ||
class="mx-auto h-auto object-cover" | ||
:width="getImageDimensions().width" | ||
:height="getImageDimensions().height" | ||
/> | ||
</div> | ||
<TextContent :text="props.text" :button="props.button" /> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import type { ImageTextProps, ImageDimensions } from '~/components/ui/ImageText/types'; | ||
const viewport = useViewport(); | ||
const props = defineProps<ImageTextProps>(); | ||
const positionClass = computed(() => (props.image?.imageAlignment === 'right' ? 'md:flex-row-reverse' : 'md:flex-row')); | ||
const getImageUrl = () => { | ||
switch (viewport.breakpoint.value) { | ||
case 'lg': { | ||
return props.image?.desktop; | ||
} | ||
case 'md': { | ||
return props.image?.tablet; | ||
} | ||
default: { | ||
return props.image?.mobile; | ||
} | ||
} | ||
}; | ||
const getImageDimensions = (): ImageDimensions => { | ||
switch (viewport.breakpoint.value) { | ||
case 'lg': { | ||
return { width: 1200, height: 800 }; | ||
} | ||
case 'md': { | ||
return { width: 800, height: 533 }; | ||
} | ||
default: { | ||
return { width: 400, height: 267 }; | ||
} | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export type ImageTextProps = { | ||
image?: { | ||
desktop?: string; | ||
tablet?: string; | ||
mobile?: string; | ||
alt: string; | ||
imageAlignment: 'left' | 'right'; | ||
}; | ||
|
||
text?: { | ||
pretitle?: string; | ||
title?: string; | ||
subtitle?: string; | ||
htmlDescription?: string; | ||
textAlignment?: 'left' | 'center' | 'right'; | ||
}; | ||
button?: { | ||
label?: string; | ||
link?: string; | ||
variant?: 'primary' | 'secondary'; | ||
}; | ||
}; | ||
|
||
export interface ImageDimensions { | ||
width: number; | ||
height: number; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,22 @@ | ||
<template> | ||
<div :class="['w-full', 'flex', 'flex-col', 'items-start', 'p-5', 'space-y-4', textAlignmentClass]"> | ||
<div v-if="props.text?.pretitle" class="text-xl font-bold mb-2">{{ props.text.pretitle }}</div> | ||
<h2 v-if="props.text?.title" class="text-2xl font-semibold mb-4">{{ props.text.title }}</h2> | ||
<div v-if="props.text?.subtitle" class="text-lg font-semibold">{{ props.text.subtitle }}</div> | ||
<div v-if="props.text?.htmlDescription" class="text-base" v-html="props.text.htmlDescription" /> | ||
<UiButton | ||
v-if="props.button?.label && props.button?.link" | ||
:tag="NuxtLink" | ||
:to="localePath(props.button?.link ?? '')" | ||
:variant="props.button?.variant ?? 'primary'" | ||
class="mt-3 px-4 py-2" | ||
> | ||
{{ props.button?.label }} | ||
</UiButton> | ||
<TextContent :text="props.text" :button="props.button" /> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import type { TextCardProps } from '~/components/ui/TextCard/types'; | ||
const props = defineProps<TextCardProps>(); | ||
const localePath = useLocalePath(); | ||
const NuxtLink = resolveComponent('NuxtLink'); | ||
const textAlignmentClass = computed(() => { | ||
switch (props.text?.textAlignment) { | ||
case 'center': { | ||
case 'center': | ||
return 'text-center items-center'; | ||
} | ||
case 'right': { | ||
case 'right': | ||
return 'text-right items-end'; | ||
} | ||
default: { | ||
default: | ||
return 'text-left items-start'; | ||
} | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters