PluginProbe
Hostinger Tools / 3.0.46
Hostinger Tools v3.0.46
3.0.77 3.0.76 3.0.75 3.0.74 3.0.73 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 All 108 releases
hostinger / vue-frontend / src / components / HostingerTools / SectionCard.vue

SectionCard.vue in Hostinger Tools 3.0.46, at vue-frontend/src/components/HostingerTools/SectionCard.vue

122 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <script lang="ts" setup>
2 import Card from "@/components/Card.vue";
3 import Toggle from "@/components/Toggle.vue";
4 import CopyField from "@/components/CopyField.vue";
5 import {SectionHeaderButton, SectionItem} from "@/types";
6 import Button from "@/components/Button/Button.vue";
7 import SkeletonLoader from "@/components/Loaders/SkeletonLoader.vue";
8 import Notice from "@/components/Notice.vue";
9
10 type Props = {
11 title: string;
12 isLoading?: boolean;
13 sectionItems: SectionItem[];
14 headerButtons?: SectionHeaderButton[];
15 warning?: string
16 };
17
18 type Emits = {
19 "save-section": [value: boolean, item: SectionItem];
20 };
21
22 const props = defineProps<Props & { optinMcpLink?: string }>();
23 const emit = defineEmits<Emits>();
24 </script>
25
26 <template>
27 <div class="home-section">
28 <Card v-if="isLoading">
29 <SkeletonLoader class="h-mb-24" width="50%" :height="24" rounded />
30 <SkeletonLoader
31 v-for="(item, index) in sectionItems"
32 :class="{ 'h-mb-24': index !== sectionItems.length - 1 }"
33 width="100%"
34 :height="item.copyLink ? 48 : 24"
35 rounded
36 />
37 </Card>
38 <Card v-else>
39 <template #header>
40 <div class="w-100">
41 <div class="d-flex align-items-center justify-content-between w-100">
42 <h2 class="h-m-0">{{ props.title }}</h2>
43 <div
44 v-if="headerButtons?.length > 0"
45 class="d-flex align-items-center"
46 >
47 <Button
48 size="small"
49 v-for="button in headerButtons"
50 :key="button.id"
51 :to="button.to"
52 :variant="button.variant"
53 :target="button.to ? '_blank' : undefined"
54 :icon-append="button.to ? 'icon-launch' : undefined"
55 >{{ button.text }}</Button>
56 </div>
57 </div>
58 <Notice :text="warning" v-if="warning" />
59 </div>
60 </template>
61 <div
62 class="home-section__section-item"
63 v-for="item in sectionItems"
64 :key="item.title"
65 >
66 <div class="d-flex flex-direction-column">
67 <div class="d-flex align-items-center justify-content-between w-100">
68 <div class="d-flex flex-column">
69 <h3 class="h-m-0">{{ item.title }}</h3>
70 <p class="h-m-0 text-body-2">
71 {{ item.description }}
72 <template v-if="item.id === 'optin-mcp' && optinMcpLink">
73 <a :href="optinMcpLink" target="_blank" rel="noopener" class="text-link-2 additional-link">
74 Learn more
75 </a>
76 </template>
77 </p>
78 </div>
79 <Button
80 @click="item.sideButton?.onClick"
81 v-if="item.sideButton?.text"
82 variant="text"
83 >{{ item.sideButton?.text }}</Button
84 >
85
86 <Toggle
87 v-else-if="item.toggleValue !== undefined"
88 class="h-pl-16"
89 :model-value="Boolean(item.toggleValue)"
90 :bind="false"
91 @click="emit('save-section', Boolean(!item.toggleValue), item)"
92 />
93 </div>
94 </div>
95 <CopyField class="h-mt-16" v-if="item.copyLink" :link="item.copyLink" />
96 </div>
97 </Card>
98 </div>
99 </template>
100
101 <style lang="scss">
102 .home-section {
103 &__section-item {
104 margin-top: 16px;
105 flex-direction: column;
106 display: flex;
107 padding-bottom: 16px;
108 border-bottom: 1px solid var(--gray-border);
109
110 &:last-child {
111 margin-bottom: 0;
112 border-bottom: none;
113 padding-bottom: 0;
114 }
115
116 .additional-link {
117 text-decoration: none!important;
118 }
119 }
120 }
121 </style>
122