ameliabooking
/
v3
/
src
/
views
/
common
/
SbsFormConstruction
/
MainContent
/
parts
/
MainContentHeader.vue
ameliabooking
/
v3
/
src
/
views
/
common
/
SbsFormConstruction
/
MainContent
/
parts
Last commit date
MainContentFooter.vue
1 month ago
MainContentHeader.vue
1 week ago
MainPanelHeader.vue
1 month ago
MainProfileFooter.vue
1 month ago
MainContentHeader.vue
271 lines
| 1 | <template> |
| 2 | <div |
| 3 | class="am-fs__main-heading" |
| 4 | :class="{ 'am-fs__main-heading-mobile': mobile }" |
| 5 | role="region" |
| 6 | :style="cssVars" |
| 7 | > |
| 8 | <span |
| 9 | v-if="stepIndex in sidebarSteps && 'label' in sidebarSteps[stepIndex] && ready" |
| 10 | class="am-fs__main-heading-inner" |
| 11 | > |
| 12 | <AmButton |
| 13 | v-if="stepIndex > 0" |
| 14 | ref="backButtonRef" |
| 15 | class="am-heading-prev" |
| 16 | :icon="{ |
| 17 | components: { IconComponent }, |
| 18 | template: `<IconComponent icon=${isRtl ? 'arrow-right' : 'arrow-left'} />`, |
| 19 | }" |
| 20 | :icon-only="true" |
| 21 | aria-label="previous step" |
| 22 | size="micro" |
| 23 | type="plain" |
| 24 | category="secondary" |
| 25 | :disabled="loading" |
| 26 | @click="previousStep" |
| 27 | ></AmButton> |
| 28 | <span |
| 29 | class="am-fs__main-heading-inner-title" |
| 30 | role="status" |
| 31 | aria-live="polite" |
| 32 | aria-atomic="true" |
| 33 | > |
| 34 | {{ |
| 35 | stepIndex in sidebarSteps && 'label' in sidebarSteps[stepIndex] |
| 36 | ? sidebarSteps[stepIndex].label |
| 37 | : '' |
| 38 | }} |
| 39 | </span> |
| 40 | </span> |
| 41 | <span v-else class="am-fs__main-heading-skeleton"> |
| 42 | <el-skeleton animated> |
| 43 | <template #template> |
| 44 | <el-skeleton-item /> |
| 45 | </template> |
| 46 | </el-skeleton> |
| 47 | </span> |
| 48 | </div> |
| 49 | <!-- Step Slider for Small screen --> |
| 50 | <template v-if="checkScreen || !sidebarVisible"> |
| 51 | <div class="am-progress-bar" :style="cssVars"> |
| 52 | <span |
| 53 | v-for="(step, i) in marks" |
| 54 | :key="i" |
| 55 | class="am-step" |
| 56 | :class="i === sliderValue ? 'am-current-step' : i < sliderValue ? 'am-passed-step' : ''" |
| 57 | > |
| 58 | </span> |
| 59 | </div> |
| 60 | </template> |
| 61 | <!-- /Step Slider for Small screen --> |
| 62 | </template> |
| 63 | |
| 64 | <script setup> |
| 65 | import AmButton from '../../../../_components/button/AmButton.vue' |
| 66 | import IconComponent from '../../../../_components/icons/IconComponent.vue' |
| 67 | |
| 68 | import { useColorTransparency } from '../../../../../assets/js/common/colorManipulation' |
| 69 | import { ref, computed, inject, watch, nextTick } from 'vue' |
| 70 | import { useStore } from 'vuex' |
| 71 | |
| 72 | const store = useStore() |
| 73 | |
| 74 | defineProps({ |
| 75 | sidebarVisible: { |
| 76 | type: Boolean, |
| 77 | default: true, |
| 78 | }, |
| 79 | ready: { |
| 80 | type: Boolean, |
| 81 | default: true, |
| 82 | }, |
| 83 | }) |
| 84 | |
| 85 | let loading = computed(() => store.getters['booking/getLoading']) |
| 86 | |
| 87 | let isRtl = computed(() => store.getters['getIsRtl']) |
| 88 | |
| 89 | // * Step Index |
| 90 | const stepIndex = inject('stepIndex', ref(0)) |
| 91 | const backButtonRef = ref(null) |
| 92 | |
| 93 | // * Step Functions |
| 94 | const { previousStep } = inject('changingStepsFunctions', { |
| 95 | previousStep: () => {}, |
| 96 | }) |
| 97 | |
| 98 | // * Data that are collected form component steps that are used in Sidebar |
| 99 | let sidebarSteps = inject('sidebarSteps', [ |
| 100 | { |
| 101 | label: '', |
| 102 | stepSelectedData: [], |
| 103 | finished: false, |
| 104 | selected: false, |
| 105 | }, |
| 106 | ]) |
| 107 | |
| 108 | // * Slider Value |
| 109 | const sliderValue = computed(() => stepIndex.value) |
| 110 | |
| 111 | // * Create marks from number of steps |
| 112 | const marks = Array.from({ length: sidebarSteps.value.length }, () => '') |
| 113 | |
| 114 | // * Container Width |
| 115 | let cWidth = inject('containerWidth', 0) |
| 116 | let checkScreen = computed(() => cWidth.value <= 560) |
| 117 | // let sidebarVisibility = amCustomize |
| 118 | let mobile = computed(() => cWidth.value < 410) |
| 119 | |
| 120 | // * Colors |
| 121 | let amColors = inject( |
| 122 | 'amColors', |
| 123 | ref({ |
| 124 | colorPrimary: '#1246D6', |
| 125 | colorSuccess: '#019719', |
| 126 | colorError: '#B4190F', |
| 127 | colorWarning: '#CCA20C', |
| 128 | colorMainBgr: '#FFFFFF', |
| 129 | colorMainHeadingText: '#33434C', |
| 130 | colorMainText: '#1A2C37', |
| 131 | colorSbBgr: '#17295A', |
| 132 | colorSbText: '#FFFFFF', |
| 133 | colorInpBgr: '#FFFFFF', |
| 134 | colorInpBorder: '#D1D5D7', |
| 135 | colorInpText: '#1A2C37', |
| 136 | colorInpPlaceHolder: '#1A2C37', |
| 137 | colorDropBgr: '#FFFFFF', |
| 138 | colorDropBorder: '#D1D5D7', |
| 139 | colorDropText: '#0E1920', |
| 140 | colorBtnPrim: '#265CF2', |
| 141 | colorBtnPrimText: '#FFFFFF', |
| 142 | colorBtnSec: '#1A2C37', |
| 143 | colorBtnSecText: '#FFFFFF', |
| 144 | }), |
| 145 | ) |
| 146 | |
| 147 | // * Calculate Step Width |
| 148 | let cssVars = computed(() => { |
| 149 | return { |
| 150 | '--am-step-length': `${100 / marks.length}%`, |
| 151 | '--am-c-main-heading-text-op15': useColorTransparency(amColors.value.colorMainText, 0.15), |
| 152 | } |
| 153 | }) |
| 154 | |
| 155 | watch( |
| 156 | () => stepIndex.value, |
| 157 | async () => { |
| 158 | if (stepIndex.value <= 0 || loading.value) { |
| 159 | return |
| 160 | } |
| 161 | |
| 162 | await nextTick() |
| 163 | |
| 164 | const backButtonElement = backButtonRef.value?.$el || backButtonRef.value |
| 165 | const focusTarget = |
| 166 | backButtonElement && typeof backButtonElement.querySelector === 'function' |
| 167 | ? backButtonElement.querySelector('button') || backButtonElement |
| 168 | : backButtonElement |
| 169 | |
| 170 | if (focusTarget && typeof focusTarget.focus === 'function') { |
| 171 | focusTarget.focus() |
| 172 | } |
| 173 | }, |
| 174 | ) |
| 175 | </script> |
| 176 | |
| 177 | <style lang="scss"> |
| 178 | @mixin main-content-header { |
| 179 | .am-fs { |
| 180 | &__main { |
| 181 | &-heading { |
| 182 | padding: 16px 32px; |
| 183 | box-shadow: 0 2px 3px var(--am-c-main-heading-text-op15); |
| 184 | |
| 185 | &-inner { |
| 186 | display: flex; |
| 187 | align-items: center; |
| 188 | gap: 0 12px; |
| 189 | |
| 190 | &-title { |
| 191 | font-family: var(--am-font-family); |
| 192 | font-size: 18px; |
| 193 | font-weight: 500; |
| 194 | font-style: normal; |
| 195 | line-height: 1.55; |
| 196 | text-transform: initial; |
| 197 | letter-spacing: initial; |
| 198 | color: var(--am-c-main-heading-text); |
| 199 | margin: 0; |
| 200 | white-space: nowrap; |
| 201 | |
| 202 | &:before { |
| 203 | // theme Twenty Nineteen |
| 204 | display: none; |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | .am-heading { |
| 209 | &-prev, |
| 210 | &-next { |
| 211 | box-shadow: none; |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | &-skeleton { |
| 217 | display: flex; |
| 218 | flex-direction: row; |
| 219 | align-items: center; |
| 220 | .el-skeleton { |
| 221 | padding: 0; |
| 222 | &__item { |
| 223 | width: 170px; |
| 224 | height: 28px; |
| 225 | } |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | &-mobile { |
| 230 | padding: 16px; |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | .am-progress-bar { |
| 235 | height: 2px; |
| 236 | display: flex; |
| 237 | flex-direction: row; |
| 238 | gap: 4px; |
| 239 | width: 100%; |
| 240 | |
| 241 | .am-step { |
| 242 | height: 2px; |
| 243 | width: var(--am-step-length); |
| 244 | background: #d1d5d7; |
| 245 | } |
| 246 | |
| 247 | .am-passed-step { |
| 248 | background: var(--am-c-btn-prim); |
| 249 | } |
| 250 | |
| 251 | .am-current-step { |
| 252 | background: #808a90; |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | } |
| 257 | } |
| 258 | // am -- amelia |
| 259 | // fs -- form steps |
| 260 | |
| 261 | // Public |
| 262 | .amelia-v2-booking #amelia-container { |
| 263 | @include main-content-header; |
| 264 | } |
| 265 | |
| 266 | // Admin |
| 267 | #amelia-app-backend-new { |
| 268 | @include main-content-header; |
| 269 | } |
| 270 | </style> |
| 271 |