Skip to content

Commit

Permalink
add default link color to Timeline.Item text
Browse files Browse the repository at this point in the history
  • Loading branch information
rezrah committed Feb 7, 2024
1 parent d00cf4e commit 14dacba
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/giant-experts-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react-brand': patch
---

Add default inline link colors to Timeline.Item
16 changes: 16 additions & 0 deletions packages/react/src/Timeline/Timeline.features.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@ export const WithShorterText: StoryFn<typeof Timeline> = () => {
)
}

export const WithLinks: StoryFn<typeof Timeline> = () => {
return (
<Timeline>
<Timeline.Item>
<em>GitHub Codespaces</em> offers a <a href="/">complete dev environment</a> in seconds.
</Timeline.Item>
<Timeline.Item>
<em>GitHub Copilot</em> is your AI pair programmer that empowers you.
</Timeline.Item>
<Timeline.Item>
<em>GitHub Actions</em> automates your build, test, and deployment workflows.
</Timeline.Item>
</Timeline>
)
}

export const WithLongerText: StoryFn<typeof Timeline> = () => {
return (
<Timeline>
Expand Down
23 changes: 23 additions & 0 deletions packages/react/src/Timeline/Timeline.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,26 @@
font-style: normal;
font-weight: 500; /* TODO: update with token when available */
}

.Timeline__item a {
color: var(--brand-InlineLink-color-rest);
position: relative;
text-decoration: underline;
text-decoration-color: var(--brand-InlineLink-color-rest);
text-decoration-thickness: var(--brand-borderWidth-thin);
text-underline-position: under;
transition: var(--brand-InlineLink-transition-timing) text-decoration;
}

.Timeline__item a:hover {
text-decoration-thickness: var(--brand-borderWidth-thick);
}

.Timeline__item a {
font-weight: inherit;
color: var(--brand-InlineLink-color-rest);
}

.Timeline__item a:active {
color: var(--brand-InlineLink-color-pressed);
}
9 changes: 9 additions & 0 deletions packages/react/src/Timeline/Timeline.visual.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ test.describe('Visual Comparison: Timeline', () => {
expect(await page.screenshot()).toMatchSnapshot()
})

test('Timeline / With Links', async ({page}) => {
await page.goto(
'http://localhost:6006/iframe.html?args=&id=components-timeline-features--with-links&viewMode=story',
)

await page.waitForTimeout(500)
expect(await page.screenshot()).toMatchSnapshot()
})

test('Timeline / With Longer Text', async ({page}) => {
await page.goto(
'http://localhost:6006/iframe.html?args=&id=components-timeline-features--with-longer-text&viewMode=story',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 14dacba

Please sign in to comment.