Skip to content

Commit

Permalink
feat: add steps hover styles (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWaldschmidt authored Apr 18, 2024
1 parent 181e27f commit 1849053
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 17 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## v2.0.38

- Add hover styles to `<Steps />`
- Fix clickbox on the `<TextInput />`

## v2.0.37

- Revert `<TextInput />` changes
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lob/ui-components",
"version": "2.0.37",
"version": "2.0.38",
"engines": {
"node": ">=20.2.0",
"npm": ">=10.2.0"
Expand Down
35 changes: 24 additions & 11 deletions src/components/Steps/Steps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@
>
<template #item="{ active, index, label }">
<span :class="['uic-steps-action', { active }]">
<span :class="['uic-steps-step', { icon: Boolean(stepIcons[index]) }]">
<Icon
v-if="stepIcons[index]"
:icon="stepIcons[index]"
data-testid="uic-steps-icon"
/>
<template v-else>
{{ index + 1 }}
</template>
<span class="uic-steps-container">
<span
:class="['uic-steps-step', { icon: Boolean(stepIcons[index]) }]"
>
<Icon
v-if="stepIcons[index]"
:icon="stepIcons[index]"
data-testid="uic-steps-icon"
/>
<template v-else>
{{ index + 1 }}
</template>
</span>
<span class="uic-steps-label">{{ label }}</span>
</span>
<span class="uic-steps-label">{{ label }}</span>
<Transition>
<span v-if="active" class="uic-steps-active-indicator" />
</Transition>
Expand Down Expand Up @@ -71,9 +75,18 @@ const stepIcons = computed<Record<number, IconName>>(() => {
}
.uic-steps-action {
@apply relative;
@apply flex;
@apply cursor-pointer;
@apply py-1;
&:hover > .uic-steps-container {
@apply bg-gray-25;
}
}
.uic-steps-container {
@apply flex gap-2 items-center;
@apply py-4;
@apply px-3 py-2 my-2 rounded-xl;
@apply transition-colors;
}
.uic-steps-label {
@apply type-small-600 text-gray-600;
Expand Down
9 changes: 6 additions & 3 deletions src/components/TextInput/TextInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<div
data-testId="input-container"
:class="[
'bg-white h-11 px-3 py-2 rounded flex items-center gap-2 border border-gray-200',
'bg-white h-11 rounded flex items-center gap-2 border border-gray-200',
{
'hover:border-gray-300 focus-within:border-[#2D2D2F] focus-within:hover:border-[#2D2D2F] focus-within:outline-black focus-within:outline-offset-1 focus-within:outline-1':
!disabled && !readonly
Expand All @@ -57,6 +57,7 @@
<div
v-if="iconLeft"
:class="[
'pl-3 py-2',
modelValue && !disabled ? 'text-gray-800' : 'text-gray-500',
{ 'text-green-700': success },
{ 'text-red-600': error },
Expand All @@ -75,7 +76,7 @@
:max="max"
:pattern="pattern"
:class="[
`w-full text-gray-800 type-small-400 caret-gray-300 placeholder-gray-200 placeholder:type-small-400 outline-none ${inputClass}`,
`w-full text-gray-800 type-small-400 caret-gray-300 placeholder-gray-200 placeholder:type-small-400 outline-none px-3 py-2 ${inputClass}`,
{ nonErrorAutofill: !disabled && !readonly },
{ truncate: withCopyButton },
{ 'bg-green-50 !placeholder-green-700': success },
Expand All @@ -101,6 +102,7 @@
<button
v-if="showClearButton && modelValue"
:class="[
'pr-3 py-2',
modelValue && !disabled ? 'text-gray-800' : 'text-gray-500',
{ 'text-green-700': success },
{ 'text-red-600': error },
Expand All @@ -120,6 +122,7 @@
<div
v-if="iconRight"
:class="[
'pr-3 py-2',
modelValue && !disabled ? 'text-gray-800' : 'text-gray-500',
{ 'text-green-700': success },
{ 'text-red-600': error },
Expand All @@ -131,7 +134,7 @@
<button
v-if="withCopyButton"
type="button"
class="rounded-full px-3 h-7 type-xs-700 bg-black text-white hover:bg-gray-700 focus-within:outline-1 focus-visible:outline-black focus-visible:outline-offset-1 active:bg-gray-800 focus:bg-gray-800"
class="mr-3 my-2 rounded-full px-3 h-7 type-xs-700 bg-black text-white hover:bg-gray-700 focus-within:outline-1 focus-visible:outline-black focus-visible:outline-offset-1 active:bg-gray-800 focus:bg-gray-800"
@click="copyToClipboard"
>
{{ copyButtonLabel }}
Expand Down

0 comments on commit 1849053

Please sign in to comment.