-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from hubblecommerce/rc2.2
Release Candidate 2.2
- Loading branch information
Showing
311 changed files
with
9,595 additions
and
7,295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,9 @@ | |
], | ||
"vue/no-multiple-template-root": [ | ||
"off" | ||
], | ||
"no-useless-return": [ | ||
"off" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
__tests__/module/fixture/components/misc/MiscSkeleton.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<template> | ||
Overridden component from project root | ||
<div | ||
v-for="index in repeat" | ||
:key="index" | ||
:class="classes" | ||
:style="styles" | ||
/> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed } from 'vue' | ||
interface Props { | ||
text?: boolean, | ||
round?: boolean, | ||
circle?: boolean, | ||
height?: string | number, | ||
width?: string | number, | ||
size?: 'small' | 'medium' | 'large', | ||
repeat?: string | number, | ||
animated?: boolean, | ||
sharp?: boolean, | ||
color?: string | ||
} | ||
const props = withDefaults(defineProps<Props>(), { | ||
text: false, | ||
round: false, | ||
circle: false, | ||
height: '', | ||
width: '', | ||
size: 'medium', | ||
repeat: 1, | ||
animated: true, | ||
sharp: true, | ||
color: 'bg-base-200' | ||
}) | ||
const styles = computed(() => { | ||
let text | ||
if (props.text) { | ||
text = 'display: inline-block;' | ||
} | ||
let width = 'width: 100%;' | ||
if (props.width) { | ||
if (typeof props.width === 'number') { | ||
width = `width: ${props.width}px;` | ||
} | ||
if (typeof props.width === 'string') { | ||
width = `width: ${props.width};` | ||
} | ||
} | ||
let height = 'height: 24px;' | ||
if (props.size === 'small') { | ||
height = 'height: 24px;' | ||
} | ||
if (props.size === 'medium') { | ||
height = 'height: 32px;' | ||
} | ||
if (props.size === 'large') { | ||
height = 'height: 48px;' | ||
} | ||
if (props.circle) { | ||
width = height.replace('height', 'width') | ||
} | ||
return [ | ||
text, | ||
width, | ||
height | ||
].join(' ') | ||
}) | ||
const classes = computed(() => { | ||
let round | ||
if (props.round) { | ||
round = 'rounded-3xl' | ||
} | ||
if (!props.sharp) { | ||
round = 'rounded' | ||
} | ||
if (props.circle) { | ||
round = 'rounded-full' | ||
} | ||
let animated | ||
if (props.animated) { | ||
animated = 'animate-pulse' | ||
} | ||
return [ | ||
round, | ||
animated, | ||
props.color | ||
].join(' ') | ||
}) | ||
</script> |
5 changes: 0 additions & 5 deletions
5
__tests__/module/fixture/components/product/ProductDetail.vue
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { ref, Ref } from 'vue' | ||
// @ts-ignore | ||
import { HblIUseNotification, HblNotificationOptions, HblNotification } from '@/utils/types' | ||
|
||
const notifications: Ref<HblNotification[]> = ref([]) | ||
let notificationDefaultDisplayTime = 5 | ||
let notificationsDefaultKeepAlive = false | ||
let notificationsDefaultType = 'info' | ||
let notificationCounter = 0 | ||
|
||
export function useNotification (): HblIUseNotification { | ||
const additionalRef = ref('overridden component value') | ||
|
||
function setDefaultOptions (options: HblNotificationOptions) { | ||
notificationDefaultDisplayTime = options.displayTime != null ? options.displayTime : notificationDefaultDisplayTime | ||
notificationsDefaultKeepAlive = options.keepAlive != null ? options.keepAlive : notificationsDefaultKeepAlive | ||
notificationsDefaultType = options.type != null ? options.type : notificationsDefaultType | ||
} | ||
|
||
function showNotification ( | ||
message: string, | ||
type = notificationsDefaultType, | ||
keepAlive = notificationsDefaultKeepAlive, | ||
displayTime = notificationDefaultDisplayTime | ||
): void { | ||
const notification: HblNotification = { | ||
id: notificationCounter, | ||
message, | ||
displayTime, | ||
keepAlive, | ||
type | ||
} | ||
|
||
notifications.value.push(notification) | ||
|
||
if (!notification.keepAlive) { | ||
setTimeout(() => { | ||
closeNotification(notification.id) | ||
}, notification.displayTime != null ? notification.displayTime * 1000 : 1000) | ||
} | ||
|
||
notificationCounter++ | ||
} | ||
|
||
function closeNotification (id: number): void { | ||
notifications.value = notifications.value.filter((item) => { | ||
return item.id !== id | ||
}) | ||
} | ||
|
||
return { | ||
notifications, | ||
showNotification, | ||
closeNotification, | ||
setDefaultOptions, | ||
additionalRef | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.