Skip to content

Commit 450659c

Browse files
added tooltip component
1 parent f5bcb51 commit 450659c

File tree

5 files changed

+98
-0
lines changed

5 files changed

+98
-0
lines changed

addon/components/au-tooltip.gts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import Component from '@glimmer/component';
2+
3+
export interface AuTooltipSignature {
4+
Args: {
5+
text: string;
6+
tooltipText: string;
7+
};
8+
Element: HTMLDivElement;
9+
}
10+
11+
export default class AuTooltip extends Component<AuTooltipSignature> {
12+
<template>
13+
<div class="au-c-tooltip">
14+
<p class="au-u-h4 au-u-margin-right-tiny au-u-margin-bottom-none">
15+
{{@text}}
16+
</p>
17+
<span class="au-c-tooltip-text">{{@tooltipText}}
18+
</span>
19+
</div>
20+
</template>
21+
}

addon/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export { default as AuTimePicker } from '@appuniversum/ember-appuniversum/compon
4545
export { default as AuToaster } from '@appuniversum/ember-appuniversum/components/au-toaster';
4646
export { default as AuToggleSwitch } from '@appuniversum/ember-appuniversum/components/au-toggle-switch';
4747
export { default as AuToolbar } from '@appuniversum/ember-appuniversum/components/au-toolbar';
48+
export { default as AuTooltip } from '@appuniversum/ember-appuniversum/components/au-tooltip';
4849

4950
// Modifiers
5051
export { default as auDateInput } from '@appuniversum/ember-appuniversum/modifiers/au-date-input';

app/components/au-tooltip.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from '@appuniversum/ember-appuniversum/components/au-tooltip';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { hbs } from 'ember-cli-htmlbars';
2+
import { icons } from '../../assets/icons';
3+
4+
export default {
5+
title: 'Components/Content/AuTooltip',
6+
argTypes: {
7+
text: { control: 'text', description: '' },
8+
tooltipText: { control: 'text', description: '' },
9+
},
10+
};
11+
12+
const Template = (args) => ({
13+
template: hbs`
14+
<AuTooltip
15+
@text={{text}}
16+
@tooltipText={{tooltipText}}
17+
/>`,
18+
context: args,
19+
});
20+
21+
export const Component = Template.bind({});
22+
Component.args = {
23+
text: 'Lorem Ipsum',
24+
tooltipText: 'Tooltip text',
25+
};

styles/components/_c-tooltip.scss

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/* ==================================
2+
#TOOLTIP
3+
================================== */
4+
5+
/* Variables
6+
========================================================================== */
7+
8+
/* Component
9+
========================================================================== */
10+
11+
.au-c-tooltip {
12+
height: 100%;
13+
position: relative;
14+
display: flex;
15+
margin: auto 0;
16+
justify-self: center;
17+
align-self: center;
18+
}
19+
20+
.au-c-tooltip .au-c-tooltip-text {
21+
position: absolute;
22+
cursor: pointer;
23+
bottom: 0;
24+
left: 0;
25+
transform: translateY(100%);
26+
visibility: hidden;
27+
width: 300px;
28+
background-color: var(--au-white);
29+
color: var(--au-gray-700);
30+
text-align: center;
31+
font-size: var(--au-base);
32+
line-height: var(--au-global-line-height);
33+
display: inline-flex;
34+
gap: 0.6rem;
35+
align-items: center;
36+
font-family: var(--au-font);
37+
font-weight: var(--au-medium);
38+
border: 0.1rem solid var(--vl-grey-50);
39+
padding: 0.1rem 0.6rem 0;
40+
border-radius: 0.6rem;
41+
min-height: 2.55rem;
42+
padding: 5px 0;
43+
44+
/* Position the tooltip */
45+
position: absolute;
46+
z-index: 1;
47+
}
48+
49+
/* Modifiers
50+
========================================================================== */

0 commit comments

Comments
 (0)