Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: multiple borders #889

Merged
merged 69 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
e39b4cf
feat: per-side border widths
Tropix126 Aug 31, 2024
8605390
refactor: make `BorderWidth::is_all_zero` more sane
Tropix126 Sep 1, 2024
ffa1098
fix: wrong operator in `is_all_zero`
Tropix126 Sep 1, 2024
702046b
Merge remote-tracking branch 'upstream/main' into feat/per-side-borde…
Tropix126 Sep 13, 2024
9cc9a0c
implement parsing for per-side widths
Tropix126 Sep 13, 2024
efd883e
feat: impl `Display` for `Border`
Tropix126 Sep 13, 2024
7eced0c
fix lints
Tropix126 Sep 13, 2024
b4bbb1c
fix another lint
Tropix126 Sep 13, 2024
6129adb
chore: fmt
Tropix126 Sep 13, 2024
097ae71
Merge remote-tracking branch 'upstream/main' into feat/per-side-borde…
Tropix126 Sep 13, 2024
bbe4828
fix tests
Tropix126 Sep 13, 2024
c621f5d
fix: add `RRect::rect` to mocked engine
Tropix126 Sep 14, 2024
508a862
chore: improve border test coverage
Tropix126 Sep 14, 2024
d81ac26
fix: border test assertion
Tropix126 Sep 14, 2024
7568069
fix: radius offset calculations for different border alignments
Tropix126 Sep 15, 2024
705c88d
clean up border drawing code
Tropix126 Sep 15, 2024
c199d70
fmt
Tropix126 Sep 15, 2024
ba41652
revert needless `get_rounded_rect` name change
Tropix126 Sep 15, 2024
2053486
format
Tropix126 Sep 15, 2024
f375183
add `PathFillType` to mocked engine
Tropix126 Sep 15, 2024
fdc7cdf
remove `border_align` and place it in main syntax
Tropix126 Sep 15, 2024
2786203
add support for multiple borders per element
Tropix126 Sep 15, 2024
689180d
mock `Path::set_fill_type`
Tropix126 Sep 15, 2024
8d0df4a
update docs
Tropix126 Sep 15, 2024
e64e26b
Merge branch 'feat/per-side-border-width' into feat/multiple-borders
Tropix126 Sep 15, 2024
aff8348
update `border` attribute documentation
Tropix126 Sep 15, 2024
3062c21
Merge branch 'main' into feat/multiple-borders
Tropix126 Sep 15, 2024
525ed15
fix some poor wording in the border docs
Tropix126 Sep 15, 2024
f3febb6
fmt
Tropix126 Sep 15, 2024
8490de3
Merge branch 'main' into feat/per-side-border-width
marc2332 Sep 15, 2024
1742537
fix jagged antialiasing on borders
Tropix126 Sep 15, 2024
aef3410
lint
Tropix126 Sep 15, 2024
6c6520e
Merge branch 'feat/per-side-border-width' into feat/multiple-borders
Tropix126 Sep 15, 2024
a248b17
fmt
Tropix126 Sep 15, 2024
0f2e889
mock `Canvas::draw_drrect` and `RRect::bounds`
Tropix126 Sep 15, 2024
7f36ac5
Merge branch 'feat/per-side-border-width' into feat/multiple-borders
Tropix126 Sep 15, 2024
85fee1c
update border example
Tropix126 Sep 18, 2024
799a205
fix borders not rendering with no background
Tropix126 Sep 18, 2024
d06b684
Merge branch 'main' into feat/multiple-borders
Tropix126 Sep 28, 2024
b671d55
feat: per-side border widths (#836)
Tropix126 Sep 28, 2024
1bdf1c7
fix: checkbox component
Tropix126 Sep 28, 2024
dceb591
feat: per-side border widths
Tropix126 Aug 31, 2024
790cf4f
refactor: make `BorderWidth::is_all_zero` more sane
Tropix126 Sep 1, 2024
f6e3b97
fix: wrong operator in `is_all_zero`
Tropix126 Sep 1, 2024
b8e5e7c
implement parsing for per-side widths
Tropix126 Sep 13, 2024
320008b
feat: impl `Display` for `Border`
Tropix126 Sep 13, 2024
34f1fe7
fix lints
Tropix126 Sep 13, 2024
881e778
fix another lint
Tropix126 Sep 13, 2024
35f04bc
chore: fmt
Tropix126 Sep 13, 2024
14ed821
chore: improve border test coverage
Tropix126 Sep 14, 2024
4b95251
fix: border test assertion
Tropix126 Sep 14, 2024
5e832b8
fix: radius offset calculations for different border alignments
Tropix126 Sep 15, 2024
8a732e7
clean up border drawing code
Tropix126 Sep 15, 2024
266fec1
fmt
Tropix126 Sep 15, 2024
e37f3d5
revert needless `get_rounded_rect` name change
Tropix126 Sep 15, 2024
999a983
format
Tropix126 Sep 15, 2024
105a195
remove `border_align` and place it in main syntax
Tropix126 Sep 15, 2024
6a2d976
add support for multiple borders per element
Tropix126 Sep 15, 2024
48adccc
update docs
Tropix126 Sep 15, 2024
084d394
update `border` attribute documentation
Tropix126 Sep 15, 2024
9ea27e8
fix some poor wording in the border docs
Tropix126 Sep 15, 2024
4d16df4
fmt
Tropix126 Sep 15, 2024
cd94c7c
fix jagged antialiasing on borders
Tropix126 Sep 15, 2024
1ac69e6
lint
Tropix126 Sep 15, 2024
a723f8d
fmt
Tropix126 Sep 15, 2024
4ca5779
update border example
Tropix126 Sep 18, 2024
3da2e82
fix borders not rendering with no background
Tropix126 Sep 18, 2024
7beb609
fix: stray `border_align`
Tropix126 Sep 28, 2024
7472ad4
Merge branch 'feat/multiple-borders' of https://github.com/Tropix126/…
Tropix126 Sep 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/components/src/accordion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub fn Accordion(props: AccordionProps) -> Element {
height: "auto",
background: "{background}",
onclick,
border: "1 solid {border_fill}",
border: "1 inner {border_fill}",
{&props.summary}
rect {
overflow: "clip",
Expand Down
4 changes: 2 additions & 2 deletions crates/components/src/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ pub fn Button(
ButtonStatus::Idle => background,
};
let border = if focus.is_selected() {
format!("2 solid {focus_border_fill}")
format!("2 inner {focus_border_fill}")
} else {
format!("1 solid {border_fill}")
format!("1 inner {border_fill}")
};

rsx!(
Expand Down
5 changes: 2 additions & 3 deletions crates/components/src/checkbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub fn Checkbox(
("transparent", unselected_fill.as_ref())
};
let border = if focus.is_selected() {
format!("4 solid {}", border_fill)
format!("4 outer {}", border_fill)
} else {
"none".to_string()
};
Expand All @@ -95,7 +95,6 @@ pub fn Checkbox(
rsx!(
rect {
border,
border_align: "outer",
corner_radius: "4",
rect {
a11y_id: focus.attribute(),
Expand All @@ -105,7 +104,7 @@ pub fn Checkbox(
main_align: "center",
cross_align: "center",
corner_radius: "4",
border: "2 solid {outer_fill}",
border: "2 inner {outer_fill}",
background: "{inner_fill}",
onkeydown,
if selected {
Expand Down
4 changes: 2 additions & 2 deletions crates/components/src/dropdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ where
color: "{font_theme.color}",
corner_radius: "8",
padding: "8 16",
border: "1 solid {border_fill}",
border: "1 inner {border_fill}",
shadow: "0 4 5 0 rgb(0, 0, 0, 0.1)",
direction: "horizontal",
main_align: "center",
Expand All @@ -301,7 +301,7 @@ where
onglobalkeydown,
layer: "-1000",
margin: "{margin}",
border: "1 solid {border_fill}",
border: "1 inner {border_fill}",
overflow: "clip",
corner_radius: "8",
background: "{dropdown_background}",
Expand Down
2 changes: 1 addition & 1 deletion crates/components/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ pub fn Input(
direction: "vertical",
color: "{color}",
background: "{background}",
border: "1 solid {border_fill}",
border: "1 inner {border_fill}",
shadow: "{shadow}",
corner_radius: "{corner_radius}",
margin: "{margin}",
Expand Down
3 changes: 1 addition & 2 deletions crates/components/src/progress_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ pub fn ProgressBar(
background: "{background}",
font_size: "13",
direction: "horizontal",
border: "1 solid {background}",
border_align: "outer",
border: "1 outer {background}",
rect {
corner_radius: "999",
width: "{progress}%",
Expand Down
5 changes: 2 additions & 3 deletions crates/components/src/radio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn Radio(
unselected_fill
};
let border = if focus.is_selected() {
format!("4 solid {}", border_fill)
format!("4 outer {}", border_fill)
} else {
"none".to_string()
};
Expand All @@ -79,13 +79,12 @@ pub fn Radio(
rsx!(
rect {
border,
border_align: "outer",
corner_radius: "99",
rect {
a11y_id: focus.attribute(),
width: "18",
height: "18",
border: "2 solid {fill}",
border: "2 inner {fill}",
padding: "4",
main_align: "center",
cross_align: "center",
Expand Down
2 changes: 1 addition & 1 deletion crates/components/src/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ pub fn Slider(
};

let border = if focus.is_selected() {
format!("2 solid {}", theme.border_fill)
format!("2 inner {}", theme.border_fill)
} else {
"none".to_string()
};
Expand Down
4 changes: 2 additions & 2 deletions crates/components/src/switch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ pub fn Switch(props: SwitchProps) -> Element {

let border = if focus.is_selected() {
if props.enabled {
format!("2 solid {}", theme.enabled_focus_border_fill)
format!("2 inner {}", theme.enabled_focus_border_fill)
} else {
format!("2 solid {}", theme.focus_border_fill)
format!("2 inner {}", theme.focus_border_fill)
}
} else {
"none".to_string()
Expand Down
2 changes: 1 addition & 1 deletion crates/components/src/tooltip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn Tooltip(TooltipProps { text, theme }: TooltipProps) -> Element {
rect {
padding: "4 10",
shadow: "0 0 4 1 rgb(0, 0, 0, 0.1)",
border: "1 solid {border_fill}",
border: "1 inner {border_fill}",
corner_radius: "8",
background: "{background}",
label { max_lines: "1", font_size: "14", color: "{color}", "{text}" }
Expand Down
Loading