Skip to content

Commit

Permalink
Merge pull request #42 from LucasWerey/fix/15
Browse files Browse the repository at this point in the history
fix(dslib): add colors
  • Loading branch information
LucasWerey authored Jan 19, 2024
2 parents 867ce7b + 8ddec15 commit 580e5c9
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 13 deletions.
8 changes: 7 additions & 1 deletion src/components/CTA/Button/Button.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
title="Icon Position"
/>
</ControlDescription>
<ControlDescription>
<HstCheckbox v-model="controls.isLight" title="isLight" />
</ControlDescription>
</template>
<Variant title="Playground" auto-props-disabled>
<Button
Expand All @@ -36,6 +39,7 @@
:state="controls.state"
:iconPosition="controls.iconPosition"
:styled="controls.style"
:isLight="controls.isLight"
>Hello</Button
>
</Variant>
Expand Down Expand Up @@ -148,13 +152,15 @@ interface Props {
state: ButtonState
iconPosition: ButtonIconPosition
style: ButtonStyle
isLight: boolean
}
const controls = reactive<Props>({
type: BUTTON_TYPE_DEFAULT,
icon: 'none',
state: BUTTON_STATE_DEFAULT,
iconPosition: 'none',
style: BUTTON_STYLE_DEFAULT
style: BUTTON_STYLE_DEFAULT,
isLight: false
})
</script>
22 changes: 16 additions & 6 deletions src/components/CTA/Button/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@
'h-12 w-[375px] items-center justify-center gap-4 rounded border-2':
!isOffAndActive && !isOffAndDisabled,
'border-primary-moonstone bg-primary-moonstone text-basic-white':
isFilledAndActive && !isMediaButton,
isFilledAndActive && !isMediaButton && !isLight,
'border-0 bg-primary-lightmoonstone text-primary-moonstone':
isFilledAndActive && !isMediaButton && isLight,
'cursor-not-allowed border-basic-grey bg-basic-grey text-basic-white':
isFilledAndDisabled && !isMediaButton,
isFilledAndDisabled && !isMediaButton && !isLight,
'border-primary-moonstone bg-transparent text-primary-moonstone':
isOutlinedAndActive && !isMediaButton,
isOutlinedAndActive && !isMediaButton && !isLight,
'cursor-not-allowed border-basic-grey bg-transparent text-basic-grey':
isOutlinedAndDisabled && !isMediaButton,
isOutlinedAndDisabled && !isMediaButton && !isLight,
'gap-2 bg-inherit text-primary-moonstone': isOffAndActive && !isMediaButton,
'cursor-not-allowed gap-2 bg-inherit text-basic-grey': isOffAndDisabled && !isMediaButton,
'cursor-not-allowed gap-2 bg-inherit text-basic-grey':
isOffAndDisabled && !isMediaButton && !isLight,
'border-basic-grey bg-inherit font-normal normal-case text-basic-black':
icon && isMediaButton,
icon && isMediaButton && !isLight,
'flex-row-reverse': isIconTrailing
}"
>
Expand Down Expand Up @@ -74,6 +77,11 @@ const props = defineProps({
type: String as PropType<ButtonIconPosition>,
required: false,
validator: (value: ButtonIconPosition): boolean => BUTTON_ICON_POSITIONS.includes(value)
},
isLight: {
type: Boolean,
required: false,
default: false
}
})
Expand All @@ -85,6 +93,8 @@ const state = computed(() => props.state)
const icon = computed(() => props.icon)
const isLight = computed(() => props.isLight)
const iconPosition = computed(() => props.iconPosition)
const isFilledAndActive = computed(() => style.value === 'fill' && state.value === 'active')
Expand Down
8 changes: 7 additions & 1 deletion src/components/CTA/InputField/InputField.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
title="State"
/>
</ControlDescription>
<ControlDescription>
<HstCheckbox v-model="controls.isRequired" title="isRequired" />
</ControlDescription>
</template>
<Variant title="Playground" auto-props-disabled>
<InputField
Expand All @@ -52,6 +55,7 @@
:size="controls.size"
:state="controls.state"
:inputType="controls.inputType"
:isRequired="controls.isRequired"
@blur="() => console.log('blur')"
/>
</Variant>
Expand Down Expand Up @@ -133,6 +137,7 @@ interface Props {
size: InputFieldSize
state: InputFieldState
inputType: string
isRequired: boolean
}
const controls = reactive<Props>({
Expand All @@ -144,6 +149,7 @@ const controls = reactive<Props>({
isDateInput: false,
size: INPUTFIELD_SIZE_DEFAULT,
state: INPUTFIELD_STATE_DEFAULT,
inputType: 'text'
inputType: 'text',
isRequired: false
})
</script>
7 changes: 6 additions & 1 deletion src/components/CTA/InputField/InputField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class="h-4 pl-1 text-2 font-bold uppercase tracking-tight text-basic-black"
data-test="Label"
>
{{ label }}
{{ label + (isRequired ? ' ' : '') }}<span class="text-error" v-if="isRequired">*</span>
</p>
<div v-if="!isBigSize" class="relative h-12 w-full">
<div v-if="!hasDateInput" class="relative h-12 w-full">
Expand Down Expand Up @@ -118,6 +118,10 @@ const props = defineProps({
validator: function (value) {
return ['text', 'password', 'number', 'email'].includes(value as string)
}
},
isRequired: {
type: Boolean,
default: false
}
})
Expand All @@ -137,6 +141,7 @@ const hasError = computed(() => state.value === INPUTFIELD_STATE.error)
const hasErrorIcon = computed(() => hasError.value && hasIcon.value && !isBigSize.value)
const hasDateInput = computed(() => isDateInput.value && !isBigSize.value)
const isBigSize = computed(() => size.value === INPUTFIELD_SIZE.big)
const isRequired = computed(() => props.isRequired)
const emit = defineEmits(['update:modelValue', 'blur'])
Expand Down
2 changes: 1 addition & 1 deletion src/components/Containment/ChipContainer/ChipContainer.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div
class="border-primary-moonston bg-primary-lightmoonstone flex h-[22px] min-w-fit max-w-[95px] items-center justify-between gap-2 overflow-hidden rounded-lg border-[0.25px] bg-opacity-10 px-2 py-1 text-2 font-normal leading-5 text-primary-moonstone"
class="border-primary-moonston flex h-[22px] min-w-fit max-w-[95px] items-center justify-between gap-2 overflow-hidden rounded-lg border-[0.25px] bg-primary-lightmoonstone px-2 py-1 text-2 font-normal leading-5 text-primary-moonstone"
:class="setIconPosition"
>
<div class="flex overflow-hidden overflow-ellipsis whitespace-nowrap">
Expand Down
2 changes: 1 addition & 1 deletion src/tailwind/preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {
light: '#00F2A5',
charcoal: '#373F51',
moonstone: '#58A4B0',
lightmoonstone: '#58A4B0',
lightmoonstone: '#58A4B01A',
powder: '#A9BCD0',
platinum: '#D8DBE2'
},
Expand Down
2 changes: 1 addition & 1 deletion src/tailwind/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
light: '#00F2A5',
charcoal: '#373F51',
moonstone: '#58A4B0',
lightmoonstone: '#58A4B0',
lightmoonstone: '#58A4B01A',
powder: '#A9BCD0',
platinum: '#D8DBE2'
},
Expand Down
2 changes: 1 addition & 1 deletion src/tailwind/presetConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default Object.freeze({
light: '#00F2A5',
charcoal: '#373F51',
moonstone: '#58A4B0',
lightmoonstone: '#58A4B0',
lightmoonstone: '#58A4B01A',
powder: '#A9BCD0',
platinum: '#D8DBE2'
},
Expand Down

0 comments on commit 580e5c9

Please sign in to comment.