forked from swiftlang/swift-docc-render
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCallToAction.vue
160 lines (142 loc) · 3.16 KB
/
CallToAction.vue
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!--
This source file is part of the Swift.org open source project
Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception
See https://swift.org/LICENSE.txt for license information
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
-->
<template>
<div class="call-to-action">
<Row>
<LeftColumn>
<span class="label">{{label}}</span>
<h2> {{ title }} </h2>
<ContentNode v-if="abstract" class="description" :content="[abstractParagraph]"/>
<Button v-if="action" :action="action" />
</LeftColumn>
<RightColumn class="right-column">
<Asset v-if="media" class="media" :identifier="media"/>
</RightColumn>
</Row>
</div>
</template>
<script>
import Asset from 'docc-render/components/Asset.vue';
import ContentNode from 'docc-render/components/ContentNode.vue';
import GridRow from 'docc-render/components/GridRow.vue';
import GridColumn from 'docc-render/components/GridColumn.vue';
import CallToActionButton from './CallToActionButton.vue';
export default {
name: 'CallToAction',
components: {
Asset,
Button: CallToActionButton,
ContentNode,
LeftColumn: {
render(createElement) {
return createElement(
GridColumn,
{
props: {
span: {
large: 5,
small: 12,
},
},
},
this.$slots.default,
);
},
},
RightColumn: {
render(createElement) {
return createElement(
GridColumn,
{
props: {
span: {
large: 6,
small: 12,
},
},
},
this.$slots.default,
);
},
},
Row: GridRow,
},
props: {
title: {
type: String,
required: true,
},
label: {
type: String,
required: true,
},
abstract: {
type: Array,
required: false,
},
action: {
type: Object,
required: false,
},
media: {
type: String,
required: false,
},
},
computed: {
// Wraps the abstract in a paragraph element, so that we can pass it to `ContentNode`.
abstractParagraph() {
return {
type: 'paragraph',
inlineContent: this.abstract,
};
},
},
};
</script>
<style scoped lang="scss">
@import "docc-render/styles/_core.scss";
.call-to-action {
padding: 65px 0;
background: var(--color-call-to-action-background);
}
.theme-dark .call-to-action {
--color-call-to-action-background: rgb(66, 66, 66);
}
.row {
@include breakpoint-content;
display: flex;
align-items: center;
}
:deep(img), :deep(video) {
max-height: 560px;
}
h2 {
@include font-styles(heading-2);
}
.label {
display: block;
@include font-styles(eyebrow-reduced);
margin-bottom: var(--spacing-stacked-margin-small);
color: var(--color-eyebrow);
}
.content {
margin-bottom: 1.5rem;
}
.right-column {
margin-left: auto;
}
@include breakpoint(small) {
.row {
display: block;
}
.col + .col {
margin-top: 40px;
}
}
</style>