gpui: Add underline
style method (#24784)
Release Notes: - N/A Add a shorter method to apply underline style. https://tailwindcss.com/docs/text-decoration-line#underling-text --------- Co-authored-by: Marshall Bowers <git@maxdeviant.com>
This commit is contained in:
parent
6516249302
commit
07ba7c8c44
1 changed files with 12 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
self as gpui, px, relative, rems, AbsoluteLength, AlignItems, CursorStyle, DefiniteLength,
|
self as gpui, px, relative, rems, AbsoluteLength, AlignItems, CursorStyle, DefiniteLength,
|
||||||
Fill, FlexDirection, FlexWrap, Font, FontStyle, FontWeight, Hsla, JustifyContent, Length,
|
Fill, FlexDirection, FlexWrap, Font, FontStyle, FontWeight, Hsla, JustifyContent, Length,
|
||||||
SharedString, StrikethroughStyle, StyleRefinement, TextOverflow, WhiteSpace,
|
SharedString, StrikethroughStyle, StyleRefinement, TextOverflow, UnderlineStyle, WhiteSpace,
|
||||||
};
|
};
|
||||||
use crate::{TextAlign, TextStyleRefinement};
|
use crate::{TextAlign, TextStyleRefinement};
|
||||||
pub use gpui_macros::{
|
pub use gpui_macros::{
|
||||||
|
@ -486,6 +486,17 @@ pub trait Styled: Sized {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sets the text decoration to underline.
|
||||||
|
/// [Docs](https://tailwindcss.com/docs/text-decoration-line#underling-text)
|
||||||
|
fn underline(mut self) -> Self {
|
||||||
|
let style = self.text_style().get_or_insert_with(Default::default);
|
||||||
|
style.underline = Some(UnderlineStyle {
|
||||||
|
thickness: px(1.),
|
||||||
|
..Default::default()
|
||||||
|
});
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Sets the decoration of the text to have a line through it.
|
/// Sets the decoration of the text to have a line through it.
|
||||||
/// [Docs](https://tailwindcss.com/docs/text-decoration#setting-the-text-decoration)
|
/// [Docs](https://tailwindcss.com/docs/text-decoration#setting-the-text-decoration)
|
||||||
fn line_through(mut self) -> Self {
|
fn line_through(mut self) -> Self {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue