PluginProbe ʕ •ᴥ•ʔ
Hostinger Tools / 3.0.72
Hostinger Tools v3.0.72
3.0.72 3.0.71 3.0.70 3.0.69 3.0.68 3.0.67 3.0.66 1.8.1 1.8.2 1.8.3 1.9.1 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.4 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.2 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 3.0.0 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.17 3.0.18 3.0.19 3.0.2 3.0.20 3.0.21 3.0.22 3.0.23 3.0.24 3.0.25 3.0.26 3.0.27 3.0.28 3.0.29 3.0.3 3.0.30 3.0.31 3.0.32 3.0.33 3.0.34 3.0.35 3.0.36 3.0.37 3.0.38 3.0.39 3.0.4 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.0.46 3.0.47 3.0.48 3.0.49 3.0.5 3.0.50 3.0.51 3.0.52 3.0.53 3.0.54 3.0.55 3.0.56 3.0.57 3.0.58 3.0.59 3.0.6 3.0.60 3.0.61 3.0.62 3.0.65 3.0.7 3.0.8 3.0.9 trunk 1.8.0
hostinger / vue-frontend / src / components / HostingerTools / SectionCard.vue
hostinger / vue-frontend / src / components / HostingerTools Last commit date
SectionCard.vue 10 months ago ToolVersionCard.vue 10 months ago
SectionCard.vue
247 lines
1 <script lang="ts" setup>
2 import Button from "@/components/Button/Button.vue";
3 import Card from "@/components/Card.vue";
4 import CopyField from "@/components/CopyField.vue";
5 import Icon from "@/components/Icon/Icon.vue";
6 import SkeletonLoader from "@/components/Loaders/SkeletonLoader.vue";
7 import Toggle from "@/components/Toggle.vue";
8 import { SectionHeaderButton, SectionItem } from "@/types";
9 import { translate } from "@/utils/helpers";
10
11 type SectionHeaderToggle = {
12 value: boolean;
13 onToggle?: (value: boolean) => void;
14 };
15
16 type Props = {
17 title: string;
18 isLoading?: boolean;
19 sectionItems: SectionItem[];
20 headerButtons?: SectionHeaderButton[];
21 headerToggle?: SectionHeaderToggle;
22 warning?: string;
23 isDisabled?: boolean;
24 };
25
26 type Emits = {
27 "save-section": [value: boolean, item: SectionItem];
28 };
29
30 defineProps<Props>();
31
32 const emit = defineEmits<Emits>();
33 </script>
34
35 <template>
36 <div class="home-section">
37 <Card v-if="isLoading">
38 <SkeletonLoader
39 class="h-mb-24"
40 width="50%"
41 :height="24"
42 rounded
43 />
44 <SkeletonLoader
45 v-for="(item, index) in sectionItems"
46 :key="`skeleton-${index}`"
47 :class="{ 'h-mb-24': index !== sectionItems.length - 1 }"
48 width="100%"
49 :height="item.copyLink ? 48 : 24"
50 rounded
51 />
52 </Card>
53 <Card v-else>
54 <template #header>
55 <div class="w-100">
56 <slot name="snackbar" />
57 <div
58 class="d-flex align-items-center justify-content-between w-100"
59 >
60 <div class="d-flex align-items-center">
61 <Toggle
62 v-if="headerToggle"
63 :model-value="headerToggle.value"
64 :bind="false"
65 :is-disabled="isDisabled"
66 class="h-mr-16"
67 @click="
68 headerToggle.onToggle &&
69 headerToggle.onToggle(!headerToggle.value)
70 "
71 />
72 <h2 class="h-m-0">
73 {{ title }}
74 </h2>
75 </div>
76 <div
77 v-if="headerButtons?.length"
78 class="d-flex align-items-center"
79 >
80 <Button
81 v-for="button in headerButtons"
82 :key="button.id"
83 size="small"
84 :to="button.to"
85 :is-disabled="isDisabled"
86 :variant="button.variant"
87 :target="button.to ? '_blank' : undefined"
88 :icon-append="
89 button.to ? 'icon-launch' : undefined
90 "
91 >
92 {{ button.text }}
93 </Button>
94 </div>
95 </div>
96 <div
97 v-if="warning"
98 class="hostinger-notice d-flex align-items-center w-100 mt-3"
99 >
100 <Icon
101 name="icon-info"
102 color="gray-dark"
103 />
104 <p class="text-body-3">
105 {{ warning }}
106 </p>
107 </div>
108 </div>
109 </template>
110 <div
111 v-for="item in sectionItems"
112 :key="item.title"
113 class="home-section__section-item"
114 :class="{
115 'home-section__section-item--disabled':
116 headerToggle && !headerToggle.value,
117 }"
118 >
119 <div class="d-flex flex-direction-column">
120 <div class="d-flex align-items-center w-100">
121 <Toggle
122 v-if="item.toggleValue !== undefined"
123 class="h-mr-16"
124 :model-value="Boolean(item.toggleValue)"
125 :bind="false"
126 :is-disabled="
127 (headerToggle && !headerToggle.value) ||
128 isDisabled
129 "
130 @click="
131 emit(
132 'save-section',
133 Boolean(!item.toggleValue),
134 item,
135 )
136 "
137 />
138 <div class="d-flex flex-column flex-grow-1">
139 <h3 class="h-m-0">
140 {{ item.title }}
141 </h3>
142 <p class="h-m-0 text-body-2">
143 {{ item.description }}
144 <template v-if="item.learnMoreLink">
145 <a
146 :href="item.learnMoreLink"
147 target="_blank"
148 rel="noopener"
149 class="text-link-2 additional-link"
150 >
151 {{
152 translate(
153 "hostinger_tools_llms_txt_learn_more",
154 )
155 }}
156 </a>
157 </template>
158 </p>
159 </div>
160 <div
161 v-if="
162 item.sideButtons?.length ||
163 item.sideButton?.text
164 "
165 class="d-flex align-items-center h-ml-16 section-buttons"
166 >
167 <Button
168 v-for="(button, index) in item.sideButtons"
169 :key="`${item.title}-${button.id || index}`"
170 size="small"
171 :variant="button.variant || 'text'"
172 :to="button.to"
173 :target="button.to ? '_blank' : undefined"
174 :icon-append="button.icon || 'icon-launch'"
175 :is-disabled="button.isDisabled || isDisabled"
176 color="primary"
177 @click="button.onClick"
178 >
179 {{ button.text }}
180 </Button>
181
182 <Button
183 v-if="
184 item.sideButton?.text &&
185 !item.sideButtons?.length
186 "
187 size="small"
188 variant="text"
189 :is-disabled="isDisabled"
190 @click="item.sideButton?.onClick"
191 >
192 {{ item.sideButton?.text }}
193 </Button>
194 </div>
195 </div>
196 </div>
197 <CopyField
198 v-if="item.copyLink"
199 class="h-mt-16"
200 :link="item.copyLink"
201 />
202 </div>
203 </Card>
204 </div>
205 </template>
206
207 <style lang="scss">
208 .home-section {
209 &__section-item {
210 display: flex;
211 flex-direction: column;
212 margin-top: 16px;
213 padding-bottom: 16px;
214 border-bottom: 1px solid var(--gray-border);
215
216 &:last-child {
217 margin-bottom: 0;
218 padding-bottom: 0;
219 border-bottom: none;
220 }
221
222 &--disabled {
223 opacity: 0.5;
224 pointer-events: none;
225 }
226
227 .additional-link {
228 text-decoration: none !important;
229 }
230 }
231
232 .section-buttons {
233 gap: 8px;
234 }
235 }
236
237 .hostinger-notice {
238 background: var(--gray-light);
239 color: var(--gray-dark);
240 border: 1px solid var(--gray-border);
241 border-radius: 12px;
242 padding: 12px 16px;
243 font-size: var(--font-size-sm);
244 gap: 1em;
245 }
246 </style>
247