Modals
1 month ago
skeletons
5 months ago
ActionButton.vue
5 months ago
ActionButtonsSection.vue
5 months ago
Banner.vue
3 months ago
FAQ.vue
5 months ago
FormItem.vue
2 months ago
FormsSection.vue
11 months ago
Hero.vue
1 month ago
Integrations.vue
4 months ago
Pagination.vue
10 months ago
PluginEntriesTable.vue
4 months ago
PluginEntry.vue
5 months ago
PluginExpansion.vue
8 months ago
SyncStatusLabel.vue
6 months ago
Tabs.vue
9 months ago
Toggle.vue
10 months ago
UsageCard.vue
10 months ago
UsageCardsRow.vue
1 year ago
UsageCardsSection.vue
1 year ago
WooCommerce.vue
5 months ago
WooCommerceEntriesTable.vue
4 months ago
Banner.vue
214 lines
| 1 | <script setup lang="ts"> |
| 2 | import { HLabel } from '@hostinger/hcomponents'; |
| 3 | |
| 4 | import { translate } from '@/utils/translate'; |
| 5 | |
| 6 | interface Props { |
| 7 | title: string; |
| 8 | description: string; |
| 9 | buttonText?: string; |
| 10 | buttonIcon?: string; |
| 11 | backgroundImage?: string; |
| 12 | isButtonDisabled?: boolean; |
| 13 | isButtonLoading?: boolean; |
| 14 | onButtonClick?: () => void; |
| 15 | label?: string; |
| 16 | align?: string; |
| 17 | } |
| 18 | |
| 19 | withDefaults(defineProps<Props>(), { |
| 20 | buttonIcon: 'ic-plus-16', |
| 21 | backgroundImage: '', |
| 22 | onButtonClick: () => {} |
| 23 | }); |
| 24 | </script> |
| 25 | |
| 26 | <template> |
| 27 | <section class="banner-section" role="banner" aria-labelledby="banner-title"> |
| 28 | <HCard padding="0" border-radius="20px"> |
| 29 | <div class="banner"> |
| 30 | <div |
| 31 | class="banner__content" |
| 32 | :class="{ |
| 33 | 'is-left': align === 'left' |
| 34 | }" |
| 35 | > |
| 36 | <div class="content-wrapper"> |
| 37 | <div class="tag-section"> |
| 38 | <HLabel v-if="label" color="primary" variant="contain">{{ label }}</HLabel> |
| 39 | </div> |
| 40 | <div class="title-section"> |
| 41 | <HText id="banner-title" as="h3" variant="heading-3"> |
| 42 | {{ title }} |
| 43 | </HText> |
| 44 | </div> |
| 45 | <div class="description-section"> |
| 46 | <HText as="p" variant="body-2" aria-describedby="banner-title"> |
| 47 | {{ description }} |
| 48 | </HText> |
| 49 | </div> |
| 50 | </div> |
| 51 | <HButton |
| 52 | v-if="buttonText" |
| 53 | size="small" |
| 54 | color="primary" |
| 55 | :icon-prepend="buttonIcon" |
| 56 | class="banner-button" |
| 57 | :is-disabled="isButtonDisabled" |
| 58 | :is-loading="isButtonLoading" |
| 59 | :aria-label="`${buttonText} - ${title}`" |
| 60 | @click="onButtonClick" |
| 61 | > |
| 62 | {{ buttonText }} |
| 63 | </HButton> |
| 64 | <div v-if="$slots.extra" class="extra-content"> |
| 65 | <slot name="extra"></slot> |
| 66 | </div> |
| 67 | </div> |
| 68 | <div |
| 69 | v-if="backgroundImage" |
| 70 | class="banner__image" |
| 71 | role="img" |
| 72 | :aria-label="`${translate('hostinger_reach_ui_banner_background_image')} ${title}`" |
| 73 | > |
| 74 | <img |
| 75 | class="banner__background-image" |
| 76 | :src="backgroundImage" |
| 77 | :alt="`${translate('hostinger_reach_ui_background_image_for')} ${title}`" |
| 78 | role="presentation" |
| 79 | /> |
| 80 | </div> |
| 81 | </div> |
| 82 | </HCard> |
| 83 | </section> |
| 84 | </template> |
| 85 | |
| 86 | <style scoped lang="scss"> |
| 87 | .banner-section { |
| 88 | display: block; |
| 89 | width: 100%; |
| 90 | } |
| 91 | |
| 92 | .banner { |
| 93 | display: grid; |
| 94 | grid-template-columns: 1fr auto; |
| 95 | gap: 24px; |
| 96 | align-items: center; |
| 97 | min-height: 160px; |
| 98 | position: relative; |
| 99 | border-radius: 20px; |
| 100 | overflow: hidden; |
| 101 | |
| 102 | @media (max-width: 992px) { |
| 103 | display: flex; |
| 104 | flex-direction: column; |
| 105 | text-align: center; |
| 106 | align-items: center; |
| 107 | justify-content: center; |
| 108 | gap: 0; |
| 109 | min-height: auto; |
| 110 | } |
| 111 | |
| 112 | &__content { |
| 113 | z-index: 2; |
| 114 | padding: 40px; |
| 115 | border-radius: 20px 0 0 20px; |
| 116 | display: flex; |
| 117 | flex-direction: column; |
| 118 | text-align: center; |
| 119 | align-items: center; |
| 120 | justify-content: center; |
| 121 | gap: 24px; |
| 122 | |
| 123 | @media (max-width: 992px) { |
| 124 | width: 100%; |
| 125 | order: 2; |
| 126 | border-radius: 20px; |
| 127 | gap: 20px; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | &__content.is-left { |
| 132 | justify-content: flex-start; |
| 133 | align-items: flex-start; |
| 134 | text-align: left; |
| 135 | |
| 136 | .title-section, |
| 137 | .description-section { |
| 138 | justify-content: flex-start; |
| 139 | margin: 0; |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | &__image { |
| 144 | position: absolute; |
| 145 | top: 0; |
| 146 | right: 0; |
| 147 | bottom: 0; |
| 148 | width: auto; |
| 149 | z-index: 1; |
| 150 | } |
| 151 | |
| 152 | &__background-image { |
| 153 | height: 100%; |
| 154 | width: auto; |
| 155 | object-fit: cover; |
| 156 | object-position: center; |
| 157 | border-radius: 0 20px 20px 0; |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | .content-wrapper { |
| 162 | display: flex; |
| 163 | width: 100%; |
| 164 | flex-direction: column; |
| 165 | gap: 8px; |
| 166 | } |
| 167 | |
| 168 | .title-section { |
| 169 | display: flex; |
| 170 | align-items: center; |
| 171 | justify-content: center; |
| 172 | gap: 16px; |
| 173 | } |
| 174 | |
| 175 | .description-section { |
| 176 | display: flex; |
| 177 | flex-direction: column; |
| 178 | align-items: center; |
| 179 | justify-content: center; |
| 180 | max-width: 65%; |
| 181 | margin: 0 auto; |
| 182 | gap: 4px; |
| 183 | } |
| 184 | |
| 185 | .banner-button { |
| 186 | align-self: center; |
| 187 | border-radius: 8px; |
| 188 | |
| 189 | &:deep(.h-button-v2) { |
| 190 | padding: 6px 16px; |
| 191 | border-radius: 8px; |
| 192 | gap: 8px; |
| 193 | |
| 194 | &:hover { |
| 195 | transform: translateY(-1px); |
| 196 | } |
| 197 | |
| 198 | &:active { |
| 199 | transform: translateY(0); |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | @media (max-width: 768px) { |
| 204 | align-self: stretch; |
| 205 | width: 100%; |
| 206 | |
| 207 | &:deep(.h-button-v2) { |
| 208 | padding: 12px 16px; |
| 209 | width: 100%; |
| 210 | } |
| 211 | } |
| 212 | } |
| 213 | </style> |
| 214 |