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

fix(styles): remove deprecated accent colors(#3227) #3693

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b6772e6
fix(docs): remove the Accent colors documentation
Oct 8, 2024
36e4bee
chore(styles): cleaned up associated tests that were validating `acce…
Oct 8, 2024
38c351d
chore(git): merge main to 3227 remove-deprecated-accent-colors branch
Oct 8, 2024
0bc4ec8
chore(styles): removed deprecated `accent-color` style definitions fr…
Oct 8, 2024
c6697a7
Removed deprecated `accent-color` style definitions from buttons docs…
Oct 8, 2024
7ae1a29
chore(styles): substituted the accent colors with hex values
Oct 8, 2024
9a1e68f
chore(styles): substituted the accent colors with hex values
Oct 8, 2024
52c63a7
chore(styles): removed the deprecated accent colors
Oct 8, 2024
4225863
Merge branch 'main' into refactor/3227-remove-deprecated-accent-colors
Oct 9, 2024
72f972b
chore(styles): substitute the accent colors with hex values
Oct 9, 2024
3832a8d
chore(styles): delete the deprecated accent colors from project varia…
Oct 9, 2024
11881db
chore(styles): substituted the accent color background bg-nightblue w…
Oct 9, 2024
db39133
fix(styles): revert the styles which do not belong to the current commit
Oct 9, 2024
496dedd
fix(styles): revert the styles which do not belong to the current commit
Oct 9, 2024
db94b7e
chore(changeset): added the changeset message
Oct 9, 2024
7c4a39e
fix(changeset): the changeset size was adjusted
Oct 16, 2024
da740f4
fix(changeset): changeset message was adjusted
Oct 16, 2024
6176302
Delete .idea/indexLayout.xml
alionazherdetska Oct 16, 2024
b4bd45b
chore(styles): change the background color for topic teaser documenta…
alionazherdetska Oct 16, 2024
fd1491a
chore(background): fix the background color in topic-teaser
alionazherdetska Oct 16, 2024
468093f
change(styles): change the background color for topic-teaser stories
alionazherdetska Oct 16, 2024
1ea1d3c
change(styles): the bg-aubergine was changed to bg-dark
Oct 16, 2024
cf02bfe
Merge branch 'refactor/3227-remove-deprecated-accent-colors' of https…
Oct 16, 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
7 changes: 7 additions & 0 deletions .changeset/red-cobras-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@swisspost/design-system-styles-primeng-workspace': patch
'@swisspost/design-system-documentation': patch
'@swisspost/design-system-styles': patch
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'@swisspost/design-system-styles-primeng-workspace': patch
'@swisspost/design-system-documentation': patch
'@swisspost/design-system-styles': patch
'@swisspost/design-system-styles-primeng-workspace': patch
'@swisspost/design-system-documentation': patch
'@swisspost/design-system-styles': major

---

Removed deprecated accent colors and updated all relevant components, documentation, and utilities.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Removed deprecated accent colors and updated all relevant components, documentation, and utilities.
Removed deprecated accent colors (nightblue, petrol, coral, olive, purple, aubergine and their light variations) and updated all relevant components, documentation, and utilities.

8 changes: 8 additions & 0 deletions .idea/indexLayout.xml
alionazherdetska marked this conversation as resolved.
Show resolved Hide resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions packages/documentation/.storybook/styles/manager.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@
color: var(--post-gray-60);
}
&[data-nodetype='component'] svg {
color: var(--post-nightblue-bright);
color: #0076a8;
}
&[data-nodetype='document'] svg {
color: var(--post-coral-bright);
color: #e03c31;
}
&[data-nodetype='story'] svg {
color: var(--post-aubergine-bright);
color: #7566a0;
}

&[data-selected='true'] {
Expand All @@ -102,10 +102,10 @@
margin-top: 1px;
width: 1.2em;
height: 1.2em;
color: var(--post-aubergine-bright);
color: #7566a0;

&[color='secondary'] {
color: var(--post-nightblue-bright);
color: #0076a8;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $tile-rg-size: var(--post-docs-tile-rg-size, calc($tile-size / 1.2));
height: $tile-size;
background-color: post.$white;
border-radius: post.$size-regular;
box-shadow: 0 2px 5px 0 rgba(post.$aubergine-dark, 0.3);
box-shadow: 0 2px 5px 0 rgba(82, 49, 120, 0.3);
text-decoration: none;
text-align: center;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ Inverted buttons don't need special classes anymore, just use any of the [backgr

<Canvas of={ButtonStories.Inverted} />

### Accent colors

<div className="alert alert-md alert-warning">
<h2 className="alert-heading">The accent colors are deprecated</h2>
<p>The CSS classes to apply to the buttons will be removed in the future.</p>
</div>

There are a number of accent colors that you can apply to buttons instead of the usual colors.

<Canvas of={ButtonStories.AccentColors} />

### Signal colors

Besides the usual and the accent button variations, there are also signal button colors.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Args, StoryContext, StoryObj } from '@storybook/web-components';
import meta, { Default, AccentColors, SignalColors } from './button.stories';
import meta, { Default, SignalColors } from './button.stories';
import { html } from 'lit';
import { bombArgs } from '@/utils';

Expand Down Expand Up @@ -42,8 +42,6 @@ export const Button: Story = {
Default.render?.({ ...context.args, ...args, animated: false }, context),
)}
<div class="mt-32 w-100"></div>
${AccentColors.render?.({ ...context.args, ...AccentColors.args }, context)}
<div class="mt-32 w-100"></div>
${SignalColors.render?.({ ...context.args, ...SignalColors.args }, context)}
</div>
`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,26 +297,6 @@ const VariantsTemplate = {
`,
};

export const AccentColors: Story = {
...VariantsTemplate,
args: {
variants: [
'btn-nightblue',
'btn-nightblue-bright',
'btn-petrol',
'btn-petrol-bright',
'btn-coral',
'btn-coral-bright',
'btn-olive',
'btn-olive-bright',
'btn-purple',
'btn-purple-bright',
'btn-aubergine',
'btn-aubergine-bright',
],
},
};

export const SignalColors: Story = {
...VariantsTemplate,
args: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const Default = {
}
</style>
${meta.render && meta.render(args, context)}
<p id="my-div" class="position-sticky bg-nightblue p-16">
<p id="my-div" class="position-sticky bg-dark p-16">
I am sticky! I am always positioned right below the header when you scroll up and down.
</p>
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const TopicTeaser: Story = {
subtitle: [short, long],
title: [short, long],
alignment: context.argTypes.alignment.options,
backgroundColor: ['bg-nightblue', 'bg-coral-bright'],
backgroundColor: ['bg-light', 'bg-dark'],
alionazherdetska marked this conversation as resolved.
Show resolved Hide resolved
linkCount: [1, 5, 10],
})
.filter((args: Args) => args.title !== args.subtitle || args.linkCount == 5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const meta: MetaComponent = {
subtitle: 'Vero siteos et accusam iretea et justo',
linkCount: 5,
alignment: 'null',
backgroundColor: 'bg-nightblue',
backgroundColor: 'bg-dark',
alionazherdetska marked this conversation as resolved.
Show resolved Hide resolved
},
argTypes: {
title: {
Expand Down Expand Up @@ -78,36 +78,9 @@ const meta: MetaComponent = {
labels: {
'bg-light': 'Light',
'bg-dark': 'Dark',
'bg-nightblue': 'Nightblue',
'bg-nightblue-bright': 'Nightblue (bright)',
'bg-petrol': 'Petrol',
'bg-petrol-bright': 'Petrol (bright)',
'bg-coral': 'Coral',
'bg-coral-bright': 'Coral (bright)',
'bg-olive': 'Olive',
'bg-olive-bright': 'Olive (bright)',
'bg-purple': 'Purple',
'bg-purple-bright': 'Purple (bright)',
'bg-aubergine': 'Aubergine',
'bg-aubergine-bright': 'Aubergine (bright)',
},
},
options: [
'bg-light',
'bg-dark',
'bg-nightblue',
'bg-nightblue-bright',
'bg-petrol',
'bg-petrol-bright',
'bg-coral',
'bg-coral-bright',
'bg-olive',
'bg-olive-bright',
'bg-purple',
'bg-purple-bright',
'bg-aubergine',
'bg-aubergine-bright',
],
options: ['bg-light', 'bg-dark'],
alionazherdetska marked this conversation as resolved.
Show resolved Hide resolved
table: {
category: 'General',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,6 @@ These colors are also available via the **Sass map** `$signal-background-colors`
})}
</section>

## Accent colors

<div className="alert alert-md alert-warning">
<h2 className="alert-heading">The accent colors are deprecated</h2>
<p>Its CSS and SASS variables will be removed in the future.</p>
</div>

These colors are also available via the **Sass map** `$accent-colors`.

<section className="color-swatch__section">
{forEach(SCSS_VARIABLES.accent, function ({ key, value}) {
return <ColorSwatch key={key} name={key} color={value} />;
})}
</section>

## Black alpha colors
These colors are also available via the **Sass map** `$post-black-alphas`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ $contrast-color-maps: (
post.$post-grays,
post.$signal-colors,
post.$signal-background-colors,
post.$accent-colors
);

:export {
Expand Down Expand Up @@ -52,10 +51,6 @@ $contrast-color-maps: (
signal-background_#{$colorName}: $value;
}

@each $colorName, $value in post.$accent-colors {
accent_#{$colorName}: $value;
}

@each $map in $contrast-color-maps {
@each $name, $value in $map {
contrast_color_#{$name}: post.get-best-contrast-text($value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

.row > *:not(.w-100) {
padding-block: 0.75rem;
background-color: lighten(post.$nightblue-bright, 55%);
border: 1px solid lighten(post.$nightblue-dark, 45%);
background-color: lighten(#0076a8, 55%);
border: 1px solid lighten(#004976, 45%);
}

.row {
background-color: lighten(post.$nightblue-bright, 61.5%);
background-color: lighten(#0076a8, 61.5%);
}

.row-height {
Expand All @@ -19,7 +19,5 @@

.standalone-columns > *:not(p){
padding-block: 0.75rem;
background-color: lighten(post.$nightblue-bright, 55%);
border: 1px solid lighten(post.$nightblue-dark, 45%);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
&.grid-nested-example [class^="col"],
&:not(.grid-nested-example) .my-col-content-style {
padding: 0.75rem;
background-color: lighten(post.$nightblue-bright, 60%);
border: 1px solid lighten(post.$nightblue-dark, 60%);
background-color: lighten(#0076a8, 60%);
border: 1px solid lighten(#004976, 60%);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ migration-global-state {
}

em {
color: post.$coral-dark;
color: #9e2a2f;
}

.info {
Expand Down
2 changes: 1 addition & 1 deletion packages/documentation/src/stories/home.styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
.feature--icon {
margin-bottom: post.$size-regular;
font-size: post.$size-huge;
color: post.$aubergine-dark;
color: #523178;
}

.feature--content {
Expand Down
Copy link
Member

Choose a reason for hiding this comment

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

The BackgroundStories.TranslucentBackgrounds story implements bg-aubergine as well. Could you change this to bg-dark there?

image

Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ To set a background on an element, simply add a `.bg-{colorname}` class to it.
})}
</section>

#### Accent

<section className="background-container__section">
{forEach(SCSS_VARIABLES.accent, function ({ key, value }) {
return <BackgroundContainer key={key} name={key} color={value} />;
})}
</section>

## Nested

It is possible to nest backgrounds.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
$non-base-background-colors: ();
$non-base-background-colors: map.merge($non-base-background-colors, post.$signal-colors);
$non-base-background-colors: map.merge($non-base-background-colors, post.$signal-background-colors);
$non-base-background-colors: map.merge($non-base-background-colors, post.$accent-colors);

:export {
@each $color, $value in post.$background-colors {
Expand All @@ -13,10 +12,6 @@ $non-base-background-colors: map.merge($non-base-background-colors, post.$accent
}
}

@each $color, $value in post.$accent-colors {
accent_#{$color}: $value;
}

@each $color, $value in post.$signal-colors {
signal_#{$color}: $value;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@use 'sass:color';
@use '@swisspost/design-system-styles/core' as post;

$margin-color: color.adjust(post.$coral-bright, $lightness: 30%);
$margin-color: color.adjust(#e03c31, $lightness: 30%);
$padding-color: color.complement($margin-color);
$gap-color: color.adjust(post.$aubergine-bright, $lightness: 30%);
$gap-color: color.adjust(#7566a0, $lightness: 30%);
$content-color: post.$white;
$border: 1px solid post.$gray-40;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ <h1 class="visually-hidden">PrimeNg data table showcase</h1>
<div
class="sticky-top border-bottom d-flex align-items-center justify-content-between py-16 mb-56"
[class.bg-white]="!hasDarkBackground"
[class.bg-nightblue]="hasDarkBackground"
[class.bg-dark]="hasDarkBackground"
>
<div class="form-check form-switch">
<input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface Product {
})
export class AppComponent {
@HostBinding('class') containerClasses = 'd-block container my-32 py-24';
@HostBinding('class.bg-nightblue') hasDarkBackground = false;
@HostBinding('class.bg-dark') hasDarkBackground = false;

datatableStyleClass = '';

Expand Down
5 changes: 0 additions & 5 deletions packages/styles/src/components/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,6 @@
}
}

// Color variants
@each $name, $color in color.$accent-colors {
@include button-mx.button-color-variant($name, $color);
}

Comment on lines -286 to -290
Copy link
Member

Choose a reason for hiding this comment

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

Removing this reduces so much CSS output. Very satisfying.

// Intranet signal buttons
@each $name, $color in color.$signal-colors {
@include button-mx.button-color-variant($name, $color);
Expand Down
1 change: 0 additions & 1 deletion packages/styles/src/components/carousel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
width: 40%;
padding: 2rem;
padding-bottom: 5rem;
background-color: rgba(color.$nightblue-dark, 0.85);
color: color.$white;
text-align: left;

Expand Down
Loading