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

UHF-9132: Add max-width limitation to all content types without sidebar except landing page #811

Merged
merged 39 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
09a5725
UHF-9132: Add max-width limitation to all content types without sideb…
teroelonen Oct 26, 2023
41f481b
UHF-9132: Merge branch 'main' of https://github.com/City-of-Helsinki/…
teroelonen Nov 20, 2023
2d33479
UHF-9132: Fix issues on components upper region with columns and cont…
teroelonen Nov 21, 2023
285a225
UHF-9132: Merge branch 'main' of https://github.com/City-of-Helsinki/…
teroelonen Nov 21, 2023
6b9cef7
UHF-9132: Removed has-sidebar spesific styles and adjusted first-side…
teroelonen Nov 22, 2023
0867caa
UHF-9132: Merge branch 'main' of https://github.com/City-of-Helsinki/…
teroelonen Nov 22, 2023
407cccc
UHF-9132: Add class to indicate components--upper region on tpr units
teroelonen Nov 22, 2023
2f178c7
UHF-9132: Move hard-coded components under the components--upper cont…
teroelonen Nov 22, 2023
d304b45
UHF-9132: Move additional information under the contact information b…
teroelonen Nov 22, 2023
7ac2ce4
UHF-9132: Sidebar component spacing fix
teroelonen Nov 22, 2023
2ae1891
UHF-9132: Add component--full-width class and assaign it to map compo…
teroelonen Nov 23, 2023
4a23e94
UHF-9132: UHF-9132: Add project-list component to exception list on c…
teroelonen Nov 23, 2023
18ebd19
UHF-9132: Merge branch 'UHF-9132' of https://github.com/City-of-Helsi…
teroelonen Nov 23, 2023
4e8bfd3
UHF-9132: Convert remote video paragraph to use component--full-width…
teroelonen Nov 23, 2023
063e1f2
UHF-9132: Convert content cards gray version to use component--full-w…
teroelonen Nov 23, 2023
292cee1
UHF-9132: Convert event list, service list search and unit search to …
teroelonen Nov 23, 2023
46d046a
UHF-9132: Add list of plans paragraph to the list of full-width-parag…
teroelonen Nov 23, 2023
24b5b87
UHF-9132: Add component--full-width classes for district and project …
teroelonen Nov 23, 2023
c22634e
UHF-9132: Layout adjustments to fix issues on for example news archive
teroelonen Nov 23, 2023
5f9d254
UHF-9132: Merge branch 'UHF-9132' of https://github.com/City-of-Helsi…
teroelonen Nov 23, 2023
0a2573b
UHF-9132: Small layout fixes for news archive
teroelonen Nov 23, 2023
fa22f2a
UHF-9132: Merge branch 'UHF-9132' of https://github.com/City-of-Helsi…
teroelonen Nov 23, 2023
27332f3
UHF-9132: Fix issues with layout changes in news archive and news ite…
teroelonen Nov 23, 2023
c39d39f
UHF-9132: Fix issue with cookie compliance page padding
teroelonen Nov 23, 2023
8d22416
UHF-9132: Merge branch 'UHF-9354_node_packages' of https://github.com…
teroelonen Nov 24, 2023
693e940
UHF-9132: Merge branch 'UHF-9354_node_packages' of https://github.com…
teroelonen Nov 24, 2023
7c29e98
UHF-9132: Merge branch 'UHF-9354_node_packages' of https://github.com…
teroelonen Nov 24, 2023
bd4b2c1
UHF-9132: Merge branch 'main' of https://github.com/City-of-Helsinki/…
teroelonen Nov 28, 2023
667357f
UHF-9132: Merge branch 'UHF-9132' of https://github.com/City-of-Helsi…
teroelonen Nov 28, 2023
a6d8c18
UHF-9132: Fix issues with news archive & news_listing__item
teroelonen Nov 28, 2023
5741588
UHF-9132: Add more specific class for content tags selector
teroelonen Nov 28, 2023
4cc8c52
UHF-9132: Remove selectors that are not required for the styles to apply
teroelonen Nov 29, 2023
bbc9f4e
UHF-9132: Merge branch 'UHF-9132' of https://github.com/City-of-Helsi…
teroelonen Nov 29, 2023
b2a7fda
UHF-9132: Replace dumb list of selectors with single selector on the …
teroelonen Nov 29, 2023
7ba5895
UHF-9132: Small readability adjustments, removing some selectors that…
teroelonen Dec 1, 2023
50bf95f
UHF-9132: Merge branch 'main' of https://github.com/City-of-Helsinki/…
teroelonen Dec 1, 2023
64250a4
UHF-9132: Update comment
teroelonen Dec 1, 2023
58f12a5
UHF-9132: Fix missing initial value from the component-gap variable i…
teroelonen Dec 1, 2023
24776d0
UHF-9132: Merge branch 'main' of https://github.com/City-of-Helsinki/…
teroelonen Dec 1, 2023
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
4 changes: 2 additions & 2 deletions dist/css/styles.min.css

Large diffs are not rendered by default.

80 changes: 66 additions & 14 deletions src/scss/06_components/layout/_component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,20 @@
@include component-margin-top;
}

// When components are full width and do not contain liftup-with-img-bg,
// When components are full width and do not contain liftup-with-img-bg or content-cards,
// they should have padding that keeps them from touching side.
.components--lower > .component:not(.component--liftup-with-image-bg),
.no-sidebar .components--upper > .component:not(.component--liftup-with-image-bg) {
.components--lower > .component:not(.component--liftup-with-image-bg, .component--content-cards),
.page-type--landing-page.no-sidebar .components--upper > .component:not(.component--liftup-with-image-bg, .component--content-cards) {
@include component-side-padding;
}

// Koro should touch the sides
.component--has-koro > .hds-koros {
margin-left: -$component-side-padding-mobile;
margin-right: -$component-side-padding-mobile;
width: calc(#{$component-side-padding-mobile} + 100% + #{$component-side-padding-mobile});
.component--full-width {
padding-bottom: $spacing-triple;
padding-top: $spacing-triple;

@if $component-side-padding-mobile != $component-side-padding-desktop {
@include breakpoint($component-side-padding-breakpoint) {
margin-left: -$component-side-padding-desktop;
margin-right: -$component-side-padding-desktop;
width: calc(#{$component-side-padding-desktop} + 100% + #{$component-side-padding-desktop});
}
@include breakpoint($breakpoint-m) {
padding-bottom: $spacing-quadruple;
padding-top: $spacing-quadruple;
}
}

Expand Down Expand Up @@ -85,3 +80,60 @@
.component__tags {
margin-top: $spacing-and-half;
}

// Components on other pages than landing-page
// need to be limited to content max-width to maintain readability.
:not(.page-type--landing-page).wrapper .components:not(.components--lower) {
Arkkimaagi marked this conversation as resolved.
Show resolved Hide resolved
@include components-container-max-width;
margin-left: auto;
margin-right: auto;

@include breakpoint($breakpoint-m) {
@include component-side-padding;
margin-left: auto;
margin-right: auto;
}

.component {
max-width: $content-width-max;
}

.component--full-width {
padding-bottom: $component-side-padding-mobile;
padding-top: $component-side-padding-mobile;

@include breakpoint($component-side-padding-breakpoint) {
padding-bottom: $component-side-padding-desktop;
padding-top: $component-side-padding-desktop;
}
}

// All other components except the full-width ones need
// to have padding on smaller screens but have it removed on larger screens.
Arkkimaagi marked this conversation as resolved.
Show resolved Hide resolved
> .component:not(.component--full-width) {
@include component-side-padding;

@include breakpoint($breakpoint-m) {
padding-left: 0;
padding-right: 0;
}
}
}

// TODO: UHF-9389 Unit needs also these following fixed elements max-width.
// This should/could be fixed by changing the elements dom to use component classes.
.no-sidebar .unit--full .main-image picture {
max-width: $content-width-max
}

// TODO: UHF-9389 Service needs also these following fixed elements max-width.
// This should/could be fixed by changing the elements dom to use component classes.
.no-sidebar .service--full .service__errand-services {
margin-left: auto;
margin-right: auto;
max-width: $content-area-wrapper-width-max;

.errand-service {
max-width: $content-width-max;
}
}
37 changes: 32 additions & 5 deletions src/scss/06_components/layout/_layout.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
$-sidebar-width: 340px;
// Calculate the sidebar width which consists of the designed content width of 340px
// and padding of $spacing-double for each side on desktop and larger screen sizes.
$-sidebar-width: calc($spacing-double + 340px + $spacing-double);

.layout-main-wrapper * {
scroll-margin-top: 113px; // Mobile header + language switcher.
Expand Down Expand Up @@ -30,7 +32,6 @@ $-sidebar-width: 340px;

@include breakpoint($breakpoint-l) {
.has-sidebar & {
column-gap: $spacing-quadruple;
grid-template-areas: 'content sidebar';
grid-template-columns: auto $-sidebar-width;
}
Expand All @@ -43,15 +44,38 @@ $-sidebar-width: 340px;
grid-template-rows: auto 1fr;
}
}
}

@include breakpoint($breakpoint-xl) {
column-gap: $spacing-triple;
.has-sidebar .main-content {
@include breakpoint($breakpoint-m) {
@include components-container-max-width;
}
}

.has-sidebar .main-content {
// Set proper width for all generic page components.
// TODO: UHF-9391 Create a helper-class that can be used here instead of this long list of selectors.
.page-title,
.lead-in,
.page-divider,
.content-date,
.main-image,
.long-desc,
.enriched-content:not(.components),
.content-links,
.content-tags:not(.content-tags--card),
.social-media__items {
Arkkimaagi marked this conversation as resolved.
Show resolved Hide resolved
@include components-container-max-width;
@include component-side-padding;
margin-left: auto;
margin-right: auto;
}

// TODO: UHF-9355 For pages that for some reason include the page title inside enriched content container we
// need to remover the double padding. This should be fixed by removing the page-title away from enriched
// content container and then remove these lines. For example news archive has this kind of setup.
.enriched-content > .page-title {
padding-left: 0;
padding-right: 0;
}

.layout-sidebar-first {
Expand All @@ -61,6 +85,8 @@ $-sidebar-width: 340px;

@include breakpoint($breakpoint-l) {
display: block;
padding-left: $spacing-double;
padding-right: $spacing-double;

.no-sidebar-second & {
margin-bottom: 0;
Expand All @@ -81,5 +107,6 @@ $-sidebar-width: 340px;
}

.layout-sidebar-second {
@include component-side-padding;
grid-area: sidebar;
}
12 changes: 4 additions & 8 deletions src/scss/06_components/navigation/_table-of-contents.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
margin-left: auto;
margin-right: auto;
}

.has-sidebar & {
@include component-negative-side-margin;
}
}

// Add extra margin to the following element if table of contents is enabled.
Expand Down Expand Up @@ -99,14 +95,14 @@
display: inline-flex;
margin-bottom: $spacing-and-half;
margin-inline-end: $spacing;

@include breakpoint($breakpoint-m) {
margin-inline-end: $spacing-and-half;
}

.hel-icon {
--icon-size: #{$spacing-quadruple};

@include breakpoint($breakpoint-m) {
--icon-size: #{remify(100px)};
}
Expand All @@ -121,11 +117,11 @@
.nojs__desc {
@include font('body');
margin-top: $spacing;

@include breakpoint($breakpoint-l) {
margin-top: $spacing-and-half;
}

p:first-child {
margin: 0;
}
Expand Down
18 changes: 0 additions & 18 deletions src/scss/06_components/pages/_basic-page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,6 @@
}
}

// stylelint-disable no-descending-specificity
// Set proper width for all generic page components
.no-sidebar {
.page-title,
.lead-in,
.page-divider,
.main-image,
.long-desc,
.enriched-content:not(.components),
.content-tags {
@include components-container-max-width;
@include component-side-padding;
margin-left: auto;
margin-right: auto;
}
}
// stylelint-enable no-descending-specificity

.content-date {
@include font('small');
color: $color-black-60;
Expand Down
1 change: 0 additions & 1 deletion src/scss/06_components/pages/_cookie-compliance.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

.cookie-compliance-block {
@include components-container-max-width;
@include component-side-padding;

.cookie-selection-instruction {
@include font('body');
Expand Down
2 changes: 2 additions & 0 deletions src/scss/06_components/pages/_news-page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
.news-listing__item {
list-style: none;
margin-top: $spacing-and-half;
padding-left: 0; // Remove card paddings from news listing
padding-right: 0; // Remove card paddings from news listing
position: relative;
}

Expand Down
102 changes: 17 additions & 85 deletions src/scss/06_components/paragraphs/_columns.scss
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
.columns {
align-items: center;
display: flex;
flex-direction: column;
$column-gap: $spacing-and-half;

.columns {
@include breakpoint($breakpoint-m) {
flex-direction: row;
margin-left: -$spacing-and-half;
margin-right: -$spacing-and-half;
}

@include breakpoint($breakpoint-l) {
margin-left: -$spacing-double;
margin-right: -$spacing-double;
grid-gap: calc($column-gap * 2);
display: grid;
}

// Overrides for image paragraph styles.
Expand All @@ -30,36 +22,26 @@
}
}

.columns__column {
align-self: stretch;

.columns--30-70 {
@include breakpoint($breakpoint-m) {
margin-left: $spacing-and-half;
margin-right: $spacing-and-half;
}

@include breakpoint($breakpoint-l) {
margin-left: $spacing-double;
margin-right: $spacing-double;
grid-template-columns: calc(30% - $column-gap) calc(70% - $column-gap);
}
}

&.column--50 {
@include breakpoint($breakpoint-m) {
width: 50%;
}
.columns--70-30 {
@include breakpoint($breakpoint-m) {
grid-template-columns: calc(70% - $column-gap) calc(30% - $column-gap);
}
}

&.column--30 {
@include breakpoint($breakpoint-m) {
width: 30%;
}
.columns--50-50 {
@include breakpoint($breakpoint-m) {
grid-template-columns: calc(50% - $column-gap) calc(50% - $column-gap);
}
}

&.column--70 {
@include breakpoint($breakpoint-m) {
width: 70%;
}
}
.columns__column {
width: 100%;

+ .columns__column {
margin-top: $spacing-double;
Expand All @@ -69,53 +51,3 @@
}
}
}

// Sidebar layout.
.has-sidebar .main-content {
// Columns in content area and inside accordion.
.columns {
@include breakpoint($breakpoint-l) {
flex-direction: column;
}

@include breakpoint($breakpoint-xl) {
flex-direction: row;
}
}

.columns__column {
@include breakpoint($breakpoint-l) {
width: auto;

&:not(:first-of-type) {
margin-top: $spacing-double;
}
}

@include breakpoint($breakpoint-xl) {
margin-top: 0;

&:not(:first-of-type) {
margin-top: 0;
}
}
}

.columns__column.column--50 {
@include breakpoint($breakpoint-xl) {
width: 50%;
}
}

.columns__column.column--30 {
@include breakpoint($breakpoint-xl) {
width: 30%;
}
}

.columns__column.column--70 {
@include breakpoint($breakpoint-xl) {
width: 70%;
}
}
}
Loading