From 043ced6f00d3b05c48d39f7b8249539bbbfd0f17 Mon Sep 17 00:00:00 2001 From: Lyza Danger Gardner Date: Wed, 17 May 2023 14:28:35 -0400 Subject: [PATCH] Update `Link` documentation for styling API Improve props formatting, deprecate `LinkBase` --- .../patterns/navigation/LinkPage.tsx | 251 ++++++++++-------- 1 file changed, 145 insertions(+), 106 deletions(-) diff --git a/src/pattern-library/components/patterns/navigation/LinkPage.tsx b/src/pattern-library/components/patterns/navigation/LinkPage.tsx index 4b961aae8..84a55e9b0 100644 --- a/src/pattern-library/components/patterns/navigation/LinkPage.tsx +++ b/src/pattern-library/components/patterns/navigation/LinkPage.tsx @@ -1,4 +1,4 @@ -import { Link, LinkBase } from '../../../../'; +import { Link } from '../../../../'; import Library from '../../Library'; export default function LinkPage() { @@ -7,88 +7,162 @@ export default function LinkPage() { title="Link" intro={

- Link is a presentational component for anchor ( - a) elements. A LinkBase base presentational - component is also available. + Link is a presentational component that provides styling + and common behavior for anchor (a) elements.

} > - - Link is a presentational component for styling links. -

- } - > + -

- Click me -

+ A link to a website
- + + Link accepts all standard{' '} + + presentational component props + + . -

- color applies to link text and hovered link text. -

- - - Sign up - - - - -
- annotation tag -
- -
- -

- - Page notes - {' '} -

+ + + Use{' '} + variant prop instead. + + + Link color affects the color of link text + (including hover color). + + + {"'brand' | 'text' | 'text-light'"} + + + {"'brand'"} + + +
+ +
+ + Note The underline prop is likely + to be removed in future and underlining will be controlled with + a styling-API prop. This prop is ignored if{' '} + unstyled is set (in which case, no underline + styling will be applied). + +
+ + + Control when underlines are applied to links. Current default is{' '} + {"'none'"}, but this will be changing in future. + Links inline with text content should set underline{' '} + to {"'always'"}. + + + {"'none' | 'hover' | 'always'"} + + + {"'none'"} + + + + +
+ + Link with underline: none + + + Link with underline: hover + + + Link with underline: always + +
+ + + + Link accepts HTML attribute props applicable to{' '} + HTMLAnchorElement. + + + {'preact.JSX.HTMLAttributes'} + + + A Link with attributes`} + size="sm" + /> + + + +
- -

- By default, Links are not underlined. This is - acceptable when the Link is a standalone, interactive - element. Underline on hover is encouraged, however, and{' '} - Links inline with text content should always be - underlined. -

- - - Log in - + +

+ Link accepts the following props from the{' '} + + presentational component styling API + + . +

+ + + + Link variants affect the color of link text + (including hover color). Set to custom to remove + theming styles. + + + {"'brand' | 'text' | 'text-light' | 'custom'"} + + + {"'brand'"} + + + + +
+ + Variant: brand (default) + + + Variant: text + + + Variant: text-light + + + Variant: custom + +
- - - Show replies (7) +
+ + + + + Set to remove all styling. + + + boolean + + + false + + + + + + Unstyled Link - -

- Links should be{' '} - - underlined - {' '} - when inline with text content. -

-
@@ -98,55 +172,20 @@ export default function LinkPage() { intro={ <>

- LinkBase is a base presentational component that - allows style customization of links. + Use the styling API of{' '} + Link for customized styling instead.

- LinkBase applies minimal common styling. Turn off all - styling by setting the unstyled prop. + LinkBase is a base presentational component that + allows style customization of links. LinkBase applies + minimal common styling. Turn off all styling by setting the{' '} + unstyled prop.

} > - - -

- This example shows a LinkBase with some additional{' '} - classes. These classes are appended to - the {"component's"} base styling classes. -

- - - alert('You clicked the link')} - > - Click me - - -
-
- - -

- Set unstyled to style your link from scratch.{' '} - Only the classes in classes are applied. -

- - alert('You clicked the link')} - unstyled - > - Click me - - -