Skip to content

Commit e68e4ba

Browse files
committed
feat: adjust text component
1 parent 360f3e6 commit e68e4ba

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

src/components/atoms/text/text.scss

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,5 +227,37 @@
227227
&-italic {
228228
--h-text--font-style: italic;
229229
}
230+
&-ellipsis-nowrap {
231+
display: -webkit-box;
232+
-webkit-line-clamp: 1;
233+
-webkit-box-orient: vertical;
234+
overflow: hidden;
235+
text-overflow: ellipsis;
236+
}
237+
&-link {
238+
cursor: pointer;
239+
240+
&:hover {
241+
text-decoration: underline;
242+
}
243+
}
244+
&-dynamic {
245+
& > a {
246+
cursor: pointer;
247+
color: var(--color-theme-secondary);
248+
font-weight: 500;
249+
250+
&:hover {
251+
text-decoration: underline;
252+
}
253+
}
254+
& > i {
255+
font-style: italic;
256+
}
257+
& > strong,
258+
& > b {
259+
font-weight: 700;
260+
}
261+
}
230262
}
231263
}

src/components/atoms/text/text.stories.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ import HText from './text.vue';
9090

9191
### Tag use:
9292

93+
Exemplo: normal html tags ou router link.
94+
9395
<Canvas>
9496
<Story name="Tag use">
9597
{{
@@ -173,7 +175,9 @@ import HText from './text.vue';
173175
<h-text weight="medium">Medium</h-text>
174176
<h-text weight="bold">Bold</h-text>
175177
<h-text italic>Italic</h-text>
176-
<h-text link tag="a" href="https://hyone-core-ui.netlify.app/">Link</h-text>
178+
<h-text ellipsis-nowrap style="width: 150px;">ellipsisNowrap example</h-text>
179+
<h-text dynamic><b>Italic</b> <i>italic</i> <a>link</a></h-text>
180+
<h-text link tag="a" href="#">Link</h-text>
177181
</div>
178182
`,
179183
}}

src/components/atoms/text/text.vue

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@
88
[`h-text--align-${align}`]: align != 'inherit',
99
[`h-text--weight-${weight}`]: weight != 'inherit',
1010
[`h-text--behavior-italic`]: italic,
11+
[`h-text--behavior-ellipsis-nowrap`]: ellipsisNowrap,
12+
[`h-text--behavior-link`]: link,
13+
[`h-text--behavior-dynamic`]: dynamic,
1114
[`h-text--color-${color}`]: color != 'inherit',
1215
[`h-text--emphasis-${emphasis}`]: emphasis != 'inherit',
1316
}"
17+
:href="href"
18+
:to="href"
1419
>
1520
<slot />
1621
</component>
@@ -97,6 +102,7 @@ export default {
97102
'a',
98103
'strong',
99104
'caption',
105+
'router-link',
100106
]),
101107
},
102108
align: {
@@ -140,6 +146,22 @@ export default {
140146
type: Boolean,
141147
default: false,
142148
},
149+
href: {
150+
type: String,
151+
default: null,
152+
},
153+
ellipsisNowrap: {
154+
type: Boolean,
155+
default: false,
156+
},
157+
link: {
158+
type: Boolean,
159+
default: false,
160+
},
161+
dynamic: {
162+
type: Boolean,
163+
default: false,
164+
},
143165
},
144166
};
145167
</script>

0 commit comments

Comments
 (0)