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(splash-page): Column display whith a low amout of items, fixing EU styles - FRONT-4662 #3687

Merged
merged 11 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,18 @@

<div class="ecl-splash-page__language-content">
{# EU languages #}
{% set container_class = 'ecl-splash-page__language-category' %}
{% if _items is not empty and _items is iterable %}
<div class="ecl-splash-page__language-category">
{% if _items|length == 1 %}
{% set container_class = container_class ~ ' ecl-splash-page__language-single-item-category' %}
{% endif %}
{% if _items|length == 2 %}
{% set container_class = container_class ~ ' ecl-splash-page__language-two-item-category' %}
{% endif %}
{% if _items|length == 4 %}
{% set container_class = container_class ~ ' ecl-splash-page__language-four-item-category' %}
{% endif %}
<div class="{{ container_class }}">
{% if _eu_category is not empty %}
<h2 class="ecl-splash-page__language-category-title">
{{- _eu_category -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ $language-list: null !default;
display: flex;
justify-content: space-between;
padding-inline-start: calc(
var(--s-m) + #{map.get($language-list, 'item-active-border-width')}
#{map.get($language-list, 'title-padding-start')} + #{map.get(
$language-list,
'item-active-border-width'
)}
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ $language-list: null !default;
font: map.get($language-list, 'header-font-mobile');
margin: 0;
padding-inline-start: calc(
var(--s-m) + #{map.get($language-list, 'item-active-border-width')}
#{map.get($language-list, 'title-padding-start')} + #{map.get(
$language-list,
'item-active-border-width'
)}
);
}

Expand Down Expand Up @@ -218,12 +221,48 @@ $language-list: null !default;
column-count: 3;
}

.ecl-splash-page__language-four-item-category
.ecl-splash-page__language-list {
display: grid;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with this change, the order of elements is not the same anymore. I don't know if that will be an issue, but I recall that the order was quite important before (also now it is different between splash page and language list)
image
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmh..right, so i reverted the styles for the standard use case of "more than two european languages" and the order is back to what it was before, but this has a small drawback, with css columns, when we have four items, we don't get three columns but two. We could handle also this as a special case, do you think it would be needed..? :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "four items in the first column" case correspond exactly to the screenshot in the ticket, so I assume that it would be quite visible.
My proposal here would be to extend the logic up to 4 items (after that it seems to be fine). Also that would be easier to name the classes based on the number of columns instead of the number of item. For instance we could have ecl-splash-page__language-category--1-col, ecl-splash-page__language-category--2-col and ecl-splash-page__language-category--3-col, and we apply it manually. That way we would reuse the classes for 2 and 4 items.
That's what is done already in the site header language list

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmh..i can rename the selectors, but the reality is that we are not dealing with the number of columns but really the number of items, ecl-splash-page__language-category--3-col for instance would be confusing, we would use that to force this single use case of 4 items, for the rest three columns would instead be the default layout and there is no other "two columns layout" other than the one we define for two items, so to me it's actually clearer using the current selectors defined.

}

.ecl-splash-page__language-two-item-category {
flex-grow: 0;

.ecl-splash-page__language-list {
display: grid;
grid-template-columns: repeat(2, 33%);
}
}

.ecl-splash-page__language-single-item-category {
flex-grow: 0;

+ .ecl-splash-page__language-category {
flex-grow: 0;
}

.ecl-splash-page__language-list {
display: grid;
grid-template-columns: repeat(1, 1fr);
}
}

.ecl-splash-page__language-link {
width: calc(#{map.get($language-list, 'item-width')} - (2 * var(--s-s)));
}
}

@include breakpoints.up('l') {
.ecl-splash-page__language-two-item-category .ecl-splash-page__language-list {
grid-template-columns: repeat(2, 1fr);
}

.ecl-splash-page__language-four-item-category
.ecl-splash-page__language-list {
grid-template-columns: repeat(3, 1fr);
}

.ecl-splash-page__language-content {
margin-top: map.get($language-list, 'content-margin-desktop');
}
Expand Down
1 change: 1 addition & 0 deletions src/themes/ec/variables/_language-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ $language-list: (
content-margin-mobile: var(--s-s),
content-margin-desktop: var(--s-s),
category-title-font: var(--f-m),
title-padding-start: var(--s-m),
category-title-font-weight: map.get($font-weight, 'regular'),
category-title-padding: (
block-start: var(--s-l),
Expand Down
9 changes: 5 additions & 4 deletions src/themes/eu/variables/_language-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
$language-list: (
color: var(--c-d-140),
container-padding-mobile: (
block-start: var(--s-l),
block-end: var(--s-m),
block-start: var(--s-2xl),
block-end: var(--s-2xl),
inline-start: var(--s-l),
inline-end: var(--s-l),
),
Expand All @@ -19,8 +19,9 @@ $language-list: (
header-font-desktop: var(--f-p-xl),
content-margin-mobile: var(--s-s),
content-margin-desktop: var(--s-s),
title-padding-start: var(--s-s),
category-title-font: var(--f-p-m),
category-title-font-weight: map.get($font-weight, 'bold'),
category-title-font-weight: map.get($font-weight, 'regular'),
category-title-padding: (
block-start: var(--s-l),
block-end: var(--s-xs),
Expand All @@ -36,7 +37,7 @@ $language-list: (
inline-end: var(--s-s),
),
code-color: var(--c-d-140),
code-font-weight: map.get($font-weight, 'bold'),
code-font-weight: map.get($font-weight, 'regular'),
code-active-font-weight: map.get($font-weight, 'bold'),
code-width: 26px,
item-active-background: var(--c-p-10),
Expand Down
2 changes: 1 addition & 1 deletion src/themes/eu/variables/_splash-page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

$splash-page: (
logo-background: var(--c-p-5),
logo-padding: var(--s-l),
logo-padding: var(--s-l) var(--s-2xl),
logo-height-mobile: 2.5rem,
logo-height-desktop: 2.75rem,
);
Expand Down
2 changes: 1 addition & 1 deletion src/website/src/pages/ec/components/splash-page/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ defaultTab: usage
status: ready
playground:
system: ec
path: /story/components-spinner--default
path: /story/components-splash-page--default
---
2 changes: 1 addition & 1 deletion src/website/src/pages/eu/components/splash-page/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ defaultTab: usage
status: ready
playground:
system: ec
path: /story/components-messages--info
path: /story/components-splash-page--default
---
Loading