Skip to content

Commit

Permalink
fix: toggle styling (#3449)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Klopper <[email protected]>
  • Loading branch information
HeleenSG and underdarknl authored Sep 6, 2024
1 parent 9804153 commit 79bba68
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 4 deletions.
70 changes: 70 additions & 0 deletions rocky/assets/css/components/toggle.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
button,
a,
input[type="button"],
input[type="submit"],
input[type="reset"] {
$breakpoint: 24rem !default;

&.toggle-button {
/* Alignment */
display: flex;
align-items: center;
justify-content: center;
align-self: flex-start;
gap: 0;
margin: 0;
box-sizing: border-box;

/* Styling */
border-radius: var(--border-radius-l);
padding: var(--spacing-grid-150);
width: 2.75rem;
height: 2.75rem;
border: 1px solid var(--colors-purrple-300);

/* Text and icon styling */
background-color: var(--colors-white);
color: var(--colors-purrple-500);
text-decoration: none;
font-size: 0;

&::before {
color: var(--colors-purrple-500);
padding: 0;
}

/* Behaviour */
cursor: pointer;
overflow-wrap: break-word;

/* States */
&[aria-current="page"] {
background-color: var(--colors-purrple-200);
border-color: var(--colors-purrple-200);

&::before {
color: var(--colors-purrple-700);
}
}

&:hover,
&:active {
border-color: var(--colors-purrple-500);
}

&:focus {
outline: 2px solid var(--colors-purrple-500);
outline-offset: 0.125rem;
z-index: 2;
position: relative;
}
}
}

a {
&.toggle-button {
&:visited {
color: var(--colors-purrple-500);
}
}
}
1 change: 1 addition & 0 deletions rocky/assets/css/components/toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
justify-content: flex-end;
align-items: center;
width: 100%;
overflow: visible; /* Making sure outline is visible on focus */

&.start {
justify-content: flex-start;
Expand Down
1 change: 1 addition & 0 deletions rocky/assets/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
@import "components/sticky";
@import "components/state-tags";
@import "components/table";
@import "components/toggle";
@import "components/toolbar";
@import "components/tree-tables";
@import "components/user-icon";
Expand Down
3 changes: 2 additions & 1 deletion rocky/assets/css/themes/soft/fundamentals/border-radii.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
:root {
--border-radius-s: 0.25rem;
--border-radius-m: 0.5rem;
--border-radius-l: 1.5rem;
--border-radius-l: 1rem;
--border-radius-xl: 1.5rem;
--border-radius-round: 50%;
}

Expand Down
2 changes: 2 additions & 0 deletions rocky/assets/css/themes/soft/manon/button-icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

:root {
--button-icon-min-width: 2.75rem;
--button-icon-width: 2.75rem;
--button-icon-min-height: 2.75rem;
--button-icon-height: 2.75rem;
--button-icon-icon-font-size: 0.8rem;
--button-icon-icon-width: 0.75rem;
}
2 changes: 1 addition & 1 deletion rocky/assets/css/themes/soft/manon/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/* Button */
--button-base-background-color: var(--branding-color-2-background-color);
--button-base-text-color: var(--branding-color-2-text-color);
--button-base-border-radius: 1rem;
--button-base-border-radius: var(--border-radius-l);
--button-base-font-family: var(--application-base-font-family);
--button-base-padding-top: var(--spacing-grid-150);
--button-base-padding-right: var(--spacing-grid-200);
Expand Down
6 changes: 4 additions & 2 deletions rocky/katalogus/templates/partials/katalogus_toolbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
{% if object_list %}
<div class="horizontal-view horizontal-scroll toolbar">
<a href="{% url url_name organization_code=organization.code view_type="grid" %}?{{ request.GET.urlencode }}"
class="button icon ti-layout-grid {% if view_type == "table" %}ghost{% endif %}">{% translate "Gridview" %}</a>
class=" icon toggle-button ti-layout-grid"
{% if view_type == "grid" %}aria-current="page"{% endif %}>{% translate "Gridview" %}</a>
<a href="{% url url_name organization_code=organization.code view_type="table" %}?{{ request.GET.urlencode }}"
class="button icon ti-menu-2 {% if view_type != "table" %}ghost{% endif %}">{% translate "Tableview" %}</a>
class=" icon toggle-button ti-menu-2"
{% if view_type == "table" %}aria-current="page"{% endif %}>{% translate "Tableview" %}</a>
</div>
{% endif %}

0 comments on commit 79bba68

Please sign in to comment.