-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathHero.vue
More file actions
79 lines (77 loc) · 1.67 KB
/
Hero.vue
File metadata and controls
79 lines (77 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<script setup lang="ts">
defineProps({
image: {
type: String,
default: null
},
imageAlt: {
type: String,
default: 'Hero Image'
},
imagePosition: {
type: String,
default: 'right'
}
})
</script>
<template>
<section class="hero">
<div class="layout">
<div class="content">
<div class="title">
<ContentSlot :use="$slots.title" unwrap="p">
Hero title
</ContentSlot>
</div>
<div class="description">
<ContentSlot :use="$slots.description" unwrap="p">
Hero description
</ContentSlot>
</div>
</div>
<NuxtImg
v-if="image"
:class="imagePosition"
:src="image"
:alt="imageAlt"
:width="16"
:height="9"
/>
</div>
</section>
</template>
<style scoped lang="ts">
css({
'.hero': {
'.layout': {
display: 'grid',
gridTemplateColumns: 'repeat(1, minmax(0, 1fr))',
gap: '{space.8}',
'@lg': {
gridTemplateColumns: 'repeat(2, minmax(0, 1fr))',
},
'.title': {
fontSize: '{text.4xl.fontSize}',
fontFamily: 'var(--typography-font-display)',
lineHeight: '{text.4xl.lineHeight}',
fontWeight: '{fontWeight.bold}',
},
'.description': {
marginTop: '{space.3}',
fontSize: '{text.xl.fontSize}',
fontFamily: 'var(--typography-font-body)',
lineHeight: '{text.xl.lineHeight}',
},
img: {
width: '100%',
aspectRatio: '16 / 9',
objectFit: 'cover',
borderRadius: '{radii.md}',
'&.left': {
order: -1
}
},
}
}
})
</style>