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(link): update link styles - FRONT-4325 #3326

Merged
merged 16 commits into from
May 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
32 changes: 3 additions & 29 deletions src/implementations/twig/components/link/link.story.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const withInverted = (story) => {

const getArgs = (data) => ({
label: data.link.label,
no_visited: data.link.no_visited || false,
icon_name: 'none',
icon_position: 'after',
external: false,
Expand Down Expand Up @@ -72,19 +71,6 @@ const getArgTypes = () => ({
type: 'boolean',
},
},
no_visited: {
name: 'no visited',
type: { name: 'boolean' },
description: 'No change of color for visited link',
table: {
type: { summary: 'boolean' },
defaultValue: { summary: false },
category: 'Content',
},
control: {
type: 'boolean',
},
},
icon_name: {
name: 'icon name',
type: { name: 'select', required: false },
Expand Down Expand Up @@ -159,7 +145,6 @@ const getArgTypes = () => ({

const prepareData = (data, args) => {
data.link.label = args.label;
data.link.no_visited = args.no_visited;
data.link.hide_label = args.hide_label;
data.link.icon_position = args.icon_position;
data.link.external = args.external;
Expand All @@ -183,15 +168,6 @@ const prepareData = (data, args) => {
return data;
};

const prepareDataButtonLink = (data, args) => {
const dataCustom = prepareData(data, args);
if (dataCustom.icon) {
data.icon.size = system === 'eu' ? 's' : 'xs';
}

return dataCustom;
};

export default {
title: 'Components/Navigation/Link',
decorators: [withNotes, withCode],
Expand Down Expand Up @@ -223,7 +199,7 @@ Standalone.parameters = { notes: { markdown: notes, json: dataStandalone } };
export const Cta = (_, { loaded: { component } }) => component;

Cta.render = async (args) => {
const renderedLinkCta = await link(prepareDataButtonLink(dataCta, args));
const renderedLinkCta = await link(prepareData(dataCta, args));
return renderedLinkCta;
};
Cta.storyName = 'call to action';
Expand All @@ -234,7 +210,7 @@ Cta.parameters = { notes: { markdown: notes, json: dataCta } };
export const Primary = (_, { loaded: { component } }) => component;

Primary.render = async (args) => {
const renderedLinkCta = await link(prepareDataButtonLink(dataPrimary, args));
const renderedLinkCta = await link(prepareData(dataPrimary, args));
return renderedLinkCta;
};
Primary.storyName = 'primary';
Expand All @@ -245,9 +221,7 @@ Primary.parameters = { notes: { markdown: notes, json: dataPrimary } };
export const Secondary = (_, { loaded: { component } }) => component;

Secondary.render = async (args) => {
const renderedLinkSecondary = await link(
prepareDataButtonLink(dataSecondary, args),
);
const renderedLinkSecondary = await link(prepareData(dataSecondary, args));
return renderedLinkSecondary;
};
Secondary.storyName = 'secondary';
Expand Down
2 changes: 2 additions & 0 deletions src/implementations/vanilla/components/link/link-print.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ $link: null !default;

.ecl-link--standalone {
font-family: #{map.get($theme, 'font-family-print', 'default')};
display: inline-block;
line-height: map.get($link, 'standalone-line-height');
}

.ecl-link--inverted {
Expand Down
7 changes: 6 additions & 1 deletion src/implementations/vanilla/components/link/link.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ $min-width: 44px; // According to COMM every interactive element should be at le
}
}

// DEPRECATED
.ecl-link--no-visited:visited {
color: map.get($link, 'color');

Expand Down Expand Up @@ -93,13 +94,16 @@ $min-width: 44px; // According to COMM every interactive element should be at le
* Standalone
*/
.ecl-link--standalone {
display: inline-block;
line-height: map.get($link, 'standalone-line-height');
text-decoration: none;

&:visited {
color: map.get($link, 'color');
}

&:hover {
color: map.get($link, 'color');
text-decoration: underline;
}
}
Expand Down Expand Up @@ -134,6 +138,7 @@ $min-width: 44px; // According to COMM every interactive element should be at le
}
}

// DEPRECATED
/* stylelint-disable-next-line plugin/selector-bem-pattern */
&.ecl-link--no-visited:visited {
color: map.get($link, 'inverted', 'color');
Expand All @@ -156,7 +161,7 @@ $min-width: 44px; // According to COMM every interactive element should be at le
box-sizing: border-box;
color: map.get($link, #{$variant}, 'color');
display: inline-block;
font: var(--f-m);
font: map.get($link, 'button', 'font');
min-width: $min-width;
padding: calc(
#{map.get($link, 'button', 'padding-vertical')} - #{map.get(
Expand Down
30 changes: 16 additions & 14 deletions src/themes/ec/variables/_link.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ $link: (
outline-color: var(--c-p),
outline-width: 2px,
outline-radius: 1px,
standalone-line-height: map.get($line-height-ui, 'xs'),
inverted: (
color: map.get($color, 'white'),
color-hover: var(--c-s-60),
Expand All @@ -17,6 +18,7 @@ $link: (
outline-color: map.get($color, 'white'),
),
button: (
font: var(--f-ui-m),
radius: 2px,
shadow: none,
border-width: 2px,
Expand All @@ -27,47 +29,47 @@ $link: (
primary: (
background: var(--c-p),
color: map.get($color, 'white'),
border-color: var(--c-p),
background-hover: var(--c-p-140),
color-hover: map.get($color, 'white'),
border-color-hover: var(--c-p-140),
background-active: var(--c-p-160),
color-active: map.get($color, 'white'),
border-color-active: var(--c-p-160),
background-focus: var(--c-p),
color-focus: map.get($color, 'white'),
border-color: var(--c-p),
border-color-hover: var(--c-p-140),
border-color-active: var(--c-p-160),
border-color-focus: var(--c-p),
outline-color: map.get($color, 'white'),
),
secondary: (
background: map.get($color, 'white'),
color: var(--c-p),
border-color: var(--c-p),
background-hover: var(--c-p-140),
color-hover: map.get($color, 'white'),
border-color-hover: var(--c-p-140),
background-active: var(--c-p-160),
color-active: map.get($color, 'white'),
border-color-active: var(--c-p-160),
background-focus: var(--c-p-160),
color-focus: map.get($color, 'white'),
border-color: var(--c-p),
border-color-hover: var(--c-p-140),
border-color-active: var(--c-p-160),
border-color-focus: var(--c-p-160),
outline-color: map.get($color, 'white'),
focus-shadow: none,
),
cta: (
background: var(--c-s-80),
background: var(--c-s),
color: var(--c-d),
background-hover: var(--c-s-120),
border-color: var(--c-s-80),
border-color: var(--c-s),
background-hover: var(--c-s-140),
color-hover: var(--c-d),
border-color-hover: var(--c-s-120),
background-active: var(--c-s-140),
border-color-hover: var(--c-s-140),
background-active: var(--c-s-160),
color-active: var(--c-d),
border-color-active: var(--c-s-140),
background-focus: var(--c-s-80),
border-color-active: var(--c-s-160),
background-focus: var(--c-s),
color-focus: var(--c-d),
border-color-focus: var(--c-s-80),
border-color-focus: var(--c-s),
outline-color: var(--c-d),
),
);
24 changes: 13 additions & 11 deletions src/themes/eu/variables/_link.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@

$link: (
color: var(--c-p),
color-hover: var(--c-p-140),
color-hover: var(--c-p-160),
color-visited: var(--c-p),
color-active: var(--c-p),
color-active: var(--c-d),
outline-color: var(--c-p),
outline-width: 2px,
outline-radius: 2px,
standalone-line-height: map.get($line-height-ui, 'xs'),
inverted: (
color: var(--c-a),
color-hover: var(--c-a-30),
color-visited: vvar(--c-a),
color-active: var(--c-a),
color-visited: var(--c-a),
color-active: map.get($color, 'white'),
outline-color: var(--c-a),
),
button: (
font: var(--f-ui-m),
radius: 4px,
shadow: var(--sh-1),
border-width: 2px,
outline-width: 1px,
padding-horizontal: var(--s-m),
padding-vertical: var(--s-s),
padding-vertical: var(--s-xs),
),
primary: (
background: var(--c-p),
Expand All @@ -31,9 +33,9 @@ $link: (
background-hover: var(--c-p-80),
color-hover: map.get($color, 'white'),
border-color-hover: var(--c-p-80),
background-active: var(--c-p-120),
background-active: var(--c-p-140),
color-active: map.get($color, 'white'),
border-color-active: var(--c-p),
border-color-active: var(--c-p-140),
background-focus: var(--c-p),
color-focus: map.get($color, 'white'),
border-color-focus: var(--c-p),
Expand All @@ -46,12 +48,12 @@ $link: (
background-hover: var(--c-p-80),
color-hover: map.get($color, 'white'),
border-color-hover: var(--c-p-80),
background-active: var(--c-p-120),
background-active: var(--c-p-140),
color-active: map.get($color, 'white'),
border-color-active: var(--c-p-120),
background-focus: var(--c-p-120),
border-color-active: var(--c-p-140),
background-focus: var(--c-p-140),
color-focus: map.get($color, 'white'),
border-color-focus: var(--c-p-120),
border-color-focus: var(--c-p-140),
outline-color: map.get($color, 'white'),
),
cta: (
Expand Down
Loading