Skip to content

Commit

Permalink
feat(textlink): add white linktype
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyiacono committed Mar 18, 2020
1 parent 7c91f8a commit ed8e327
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@
color: var(--color-text-light);
}

.TextLink--white,
.TextLink--white:link {
color: var(--color-white);

&:hover,
&:focus {
color: var(--color-white);
opacity: 0.75;
}
}

.TextLink--disabled,
.TextLink--disabled:link {
opacity: 0.5;
Expand Down Expand Up @@ -108,6 +119,14 @@

color: var(--color-text-light);
}

&.TextLink--white:hover {
& .TextLink__icon {
fill: var(--color-white);
}

color: var(--color-white);
}
}

.TextLink__icon {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ There are a number of variations of TextLink styles, here is a guide for when to
- **Negative** - Used for destructive actions - when something can't be undone. For example, deleting entities.
- **Secondary** - For actions that should be emphasized less than the default primary style.
- **Muted** - For actions that should be emphasized less than the secondary style.
- **White** - For actions appearing on a dark background.

## Best practices

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ storiesOf('Components|TextLink', module)
Negative: 'negative',
Secondary: 'secondary',
Muted: 'muted',
White: 'white',
},
'primary',
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ it('renders as a "muted" link type', () => {
expect(output).toMatchSnapshot();
});

it('renders as a "white" link type', () => {
const output = shallow(<TextLink linkType="white">Text Link</TextLink>);

expect(output).toMatchSnapshot();
});

it('calls an onClick function', () => {
const onClickFunc = jest.fn();
const output = shallow(<TextLink onClick={onClickFunc}>Text Link</TextLink>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export type TextLinkType =
| 'positive'
| 'negative'
| 'secondary'
| 'muted';
| 'muted'
| 'white';

type IconPositionType = 'right' | 'left';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,19 @@ exports[`renders as a "secondary" link type 1`] = `
</button>
`;

exports[`renders as a "white" link type 1`] = `
<button
className="TextLink TextLink--white"
data-test-id="cf-ui-text-link"
disabled={false}
type="button"
>
<TabFocusTrap>
Text Link
</TabFocusTrap>
</button>
`;

exports[`renders as a button 1`] = `
<button
className="TextLink TextLink--primary"
Expand Down

0 comments on commit ed8e327

Please sign in to comment.