Skip to content

Commit

Permalink
Merge pull request #302 from PrestaShopCorp/feat/link-article
Browse files Browse the repository at this point in the history
feat: articles variant added to link component
  • Loading branch information
mattgoud authored Jan 31, 2024
2 parents 1bdcedf + 5f5fbbf commit f466985
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 6 deletions.
5 changes: 5 additions & 0 deletions packages/components/link/src/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ export const linkProps = buildProps({
required: false,
default: false,
},
articles: {
type: Boolean,
required: false,
default: false,
},
} as const)

export type LinkProps = ExtractPropTypes<typeof linkProps>
Expand Down
1 change: 1 addition & 0 deletions packages/components/link/src/link.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'puik-link',
`puik-link--${size}`,
{ 'puik-link--high-contrast': highContrast },
{ 'puik-link--articles': articles },
]"
:data-test="dataTest"
>
Expand Down
12 changes: 11 additions & 1 deletion packages/components/link/stories/link.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,16 @@ export default {
},
highContrast: {
description:
'Sets the link in high contrast mode by disabling the purple color for the visited stated',
'Sets the link in high contrast mode by changing the gray underline color',
table: {
defaultValue: {
summary: false,
},
},
},
articles: {
description:
'Sets the link in articles mode, adding the purple color for the visited stated',
table: {
defaultValue: {
summary: false,
Expand All @@ -71,6 +80,7 @@ export default {
to: undefined,
target: '_self',
highContrast: false,
articles: false,
default: "I'm a cool link",
title: "I'm a tooltip for your link",
size: 'md',
Expand Down
5 changes: 5 additions & 0 deletions packages/components/link/test/link.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ describe('Link tests', () => {
factory({ highContrast: true })
expect(findLink().classes()).toContain('puik-link--high-contrast')
})

it('should set the link in articles mode', () => {
factory({ articles: true })
expect(findLink().classes()).toContain('puik-link--articles')
})
})
19 changes: 14 additions & 5 deletions packages/theme/src/link.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,15 @@
duration-150;

&:hover,
&:active {
&:active,
&:visited {
@apply decoration-primary underline-offset-[5px];
}

&:focus-visible {
@apply outline-none ring-2 ring-blue rounded-[4px] shadow-none;
}

&:visited {
@apply text-purple-700;
}

&__target__icon {
@apply font-materialIcons align-bottom;

Expand All @@ -52,4 +49,16 @@
}
@apply decoration-primary;
}

&--articles {
@apply decoration-primary-500;

&:visited {
@apply text-purple-700 decoration-primary-500;
}

&:focus-visible {
@apply decoration-primary-800;
}
}
}

0 comments on commit f466985

Please sign in to comment.