Skip to content

Commit

Permalink
feat(chip): add tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaeljp committed Dec 28, 2022
1 parent f51bbb6 commit d67e5b6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solfacil/components-ui",
"version": "1.88.1",
"version": "1.88.2",
"private": false,
"description": "Component library based on Vue and Tailwind",
"author": "Solfacil - Fernando Jesus",
Expand Down Expand Up @@ -118,4 +118,4 @@
"storybook"
],
"license": "MIT"
}
}
29 changes: 28 additions & 1 deletion src/assets/scss/_chip.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.chip {
@apply bg-gray1 rounded px-4 text-grayPrimary text-slight h-7 flex gap-2 items-center transition-all duration-200 ease-linear;
@apply bg-gray1 rounded px-4 text-grayPrimary text-slight h-7 flex gap-2 items-center transition-all duration-200 ease-linear relative;
width: fit-content;

.svg-wrapper {
Expand All @@ -10,6 +10,26 @@
}
}

.chip-tooltip {
@apply opacity-0 bg-grayPrimary absolute text-small text-white font-rubik font-normal rounded z-10 py-2 px-4 duration-200 ease-linear transition-all leading-tight;
bottom: calc(100% + 10px);
left: 50%;
max-width: 320px;
transform: translateX(-50%);
visibility: hidden;
width: max-content;

&::after {
@apply absolute border-solid;
border-color: #666 transparent transparent transparent;
border-width: 6px;
content: '';
left: 50%;
top: 100%;
transform: translateX(-50%);
}
}

&.small {
@apply bg-gray2 px-2 py-1 h-auto;

Expand All @@ -25,4 +45,11 @@
}
}
}

&:hover {
.chip-tooltip {
@apply opacity-100;
visibility: visible;
}
}
}
8 changes: 8 additions & 0 deletions src/components/Chip/Chip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<div class="svg-wrapper" @click="handleClick()">
<CloseIcon :class="{ small }" />
</div>
<div v-if="tooltip" class="chip-tooltip">
{{ tooltip }}
</div>
</span>
</template>

Expand All @@ -26,6 +29,11 @@ export default {
type: Boolean,
default: false,
},
tooltip: {
type: String,
default: '',
},
},
methods: {
Expand Down

0 comments on commit d67e5b6

Please sign in to comment.