gpui: Add line_through
method to Styled
(#20728)
This PR adds a `.line_through` method to the `Styled` trait that mirrors the corresponding Tailwind class. Release Notes: - N/A
This commit is contained in:
parent
7137bdee02
commit
6d80d5b74b
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, StyleRefinement, WhiteSpace,
|
SharedString, StrikethroughStyle, StyleRefinement, WhiteSpace,
|
||||||
};
|
};
|
||||||
use crate::{TextStyleRefinement, Truncate};
|
use crate::{TextStyleRefinement, Truncate};
|
||||||
pub use gpui_macros::{
|
pub use gpui_macros::{
|
||||||
|
@ -439,6 +439,17 @@ pub trait Styled: Sized {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sets the decoration of the text to have a line through it.
|
||||||
|
/// [Docs](https://tailwindcss.com/docs/text-decoration#setting-the-text-decoration)
|
||||||
|
fn line_through(mut self) -> Self {
|
||||||
|
let style = self.text_style().get_or_insert_with(Default::default);
|
||||||
|
style.strikethrough = Some(StrikethroughStyle {
|
||||||
|
thickness: px(1.),
|
||||||
|
..Default::default()
|
||||||
|
});
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Remove the text decoration on this element, this value cascades to its child elements.
|
/// Remove the text decoration on this element, this value cascades to its child elements.
|
||||||
fn text_decoration_none(mut self) -> Self {
|
fn text_decoration_none(mut self) -> Self {
|
||||||
self.text_style()
|
self.text_style()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue