-
Notifications
You must be signed in to change notification settings - Fork 32
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(Anchor): create styles for Sbanken #2250
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a148ad9
create theme file for sbanken anchor
joakbjerk 5bef3e9
create visual test for sbanken acnhors
joakbjerk e40677f
fix linting for comment
joakbjerk dbdbf63
remove extra padding from anchor
joakbjerk 6cf449b
fix anchor font-weight
joakbjerk 2e4af6e
update tests
joakbjerk 877b051
make anchor use sbanken font-weighting
joakbjerk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
151 changes: 151 additions & 0 deletions
151
packages/dnb-eufemia/src/elements/anchor/__tests__/themes/Anchor.sbanken.screenshot.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
/** | ||
* Screenshot Test | ||
* This file will not run on "test:staged" because we don't require any related files | ||
*/ | ||
|
||
import { | ||
makeScreenshot, | ||
setupPageScreenshot, | ||
} from '../../../../core/jest/jestSetupScreenshots' | ||
|
||
describe('Anchor with sbanken theme', () => { | ||
setupPageScreenshot({ | ||
url: '/uilib/elements/anchor?eufemia-theme=sbanken', | ||
}) | ||
|
||
it('have to match the "default" state', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="anchor-default"]', | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
|
||
it('have to match breaking lines', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="anchor-newline"]', | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
|
||
it('have to match anchor with skeleton', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="anchor-skeleton"]', | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
|
||
it('have to match anchor with icon', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="anchor-icon"]', | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
|
||
it('have to match anchor with paragraph', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="anchor-paragraph"]', | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
|
||
it('have to match anchor in heading', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="anchor-heading"]', | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
|
||
it('have to match the "hover" state', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="anchor-hover"]', | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
|
||
it('have to match the "active" state', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="anchor-active"]', | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
|
||
it('have to match the "focus" state', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="anchor-focus"]', | ||
simulate: 'focus', // should be tested first | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
|
||
it('have to match the anchor-contrast "default" state', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="anchor-contrast"]', | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
|
||
it('have to match the anchor-contrast "focus" state', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="anchor-contrast"]', | ||
simulate: 'focus', // should be tested first | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
|
||
it('have to match the anchor-contrast "hover" state', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="anchor-contrast"]', | ||
simulate: 'hover', | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
|
||
it('have to match the dnb-anchor--no-underline', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="anchor-in-section"]', | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
|
||
// "active" simulation is suddenly too unstable – no reason found | ||
// it('have to match the anchor-contrast "active" state', async () => { | ||
// const screenshot = await makeScreenshot({ | ||
// selector: '[data-visual-test="anchor-contrast"]', | ||
// simulate: 'active', | ||
// }) | ||
// expect(screenshot).toMatchImageSnapshot() | ||
// }) | ||
}) | ||
|
||
describe('Anchor target blank with sbanken theme', () => { | ||
setupPageScreenshot({ | ||
url: '/uilib/elements/anchor?eufemia-theme=sbanken', | ||
}) | ||
|
||
it('have to match blank target anchor in heading', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="anchor-heading-blank"]', | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
|
||
it('have to match the target blank state', async () => { | ||
const screenshot = await makeScreenshot({ | ||
selector: '[data-visual-test="anchor-blank"] a', | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
|
||
it('have to match the target blank with tooltip', async () => { | ||
const screenshot = await makeScreenshot({ | ||
style: { | ||
'padding-top': '2rem', | ||
}, | ||
waitBeforeSimulate: 200, | ||
selector: '[data-visual-test="anchor-blank"]', | ||
simulateSelector: '[data-visual-test="anchor-blank"] a.dnb-anchor', | ||
simulate: 'hover', | ||
}) | ||
expect(screenshot).toMatchImageSnapshot() | ||
}) | ||
}) |
Binary file added
BIN
+7.07 KB
...-blank-with-sbanken-theme-have-to-match-blank-target-anchor-in-heading.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.77 KB
...r-target-blank-with-sbanken-theme-have-to-match-the-target-blank-state.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.25 KB
...t-blank-with-sbanken-theme-have-to-match-the-target-blank-with-tooltip.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.58 KB
..._snapshots__/anchor-with-sbanken-theme-have-to-match-anchor-in-heading.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.7 KB
...e_snapshots__/anchor-with-sbanken-theme-have-to-match-anchor-with-icon.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.69 KB
...pshots__/anchor-with-sbanken-theme-have-to-match-anchor-with-paragraph.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+524 Bytes
...apshots__/anchor-with-sbanken-theme-have-to-match-anchor-with-skeleton.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.6 KB
...age_snapshots__/anchor-with-sbanken-theme-have-to-match-breaking-lines.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.69 KB
...e_snapshots__/anchor-with-sbanken-theme-have-to-match-the-active-state.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.78 KB
...hor-with-sbanken-theme-have-to-match-the-anchor-contrast-default-state.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.09 KB
...nchor-with-sbanken-theme-have-to-match-the-anchor-contrast-focus-state.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.92 KB
...nchor-with-sbanken-theme-have-to-match-the-anchor-contrast-hover-state.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.32 KB
..._snapshots__/anchor-with-sbanken-theme-have-to-match-the-default-state.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.36 KB
...__/anchor-with-sbanken-theme-have-to-match-the-dnb-anchor-no-underline.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.37 KB
...ge_snapshots__/anchor-with-sbanken-theme-have-to-match-the-focus-state.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.37 KB
...ge_snapshots__/anchor-with-sbanken-theme-have-to-match-the-hover-state.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions
59
packages/dnb-eufemia/src/elements/anchor/style/themes/dnb-anchor-theme-sbanken.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
@use '../anchor-mixins.scss'; | ||
|
||
.dnb-anchor { | ||
// Has to use --sb-font-weight-bold to get correct weighting as --sb-font-weight-medium does nothing at the moment | ||
font-weight: var(--sb-font-weight-bold); | ||
color: var(--sb-color-gray-dark-3); | ||
text-decoration-color: var(--sb-color-green-dark); | ||
|
||
&:hover { | ||
color: var(--sb-color-text); | ||
background-color: var(--sb-color-green-dark); | ||
|
||
border-radius: 0.5rem; | ||
} | ||
|
||
&:active { | ||
color: var(--sb-color-text); | ||
background-color: var(--sb-color-green); | ||
|
||
border-radius: 0.5rem; | ||
} | ||
|
||
&:focus { | ||
&:not(:active) { | ||
color: var(--sb-color-blue-dark); | ||
background-color: var(--sb-color-blue-light-3); | ||
|
||
border-radius: 0.25rem; | ||
} | ||
} | ||
} | ||
|
||
.dnb-anchor--hover { | ||
color: var(--sb-color-text); | ||
background-color: var(--sb-color-green-dark); | ||
|
||
border-radius: 0.5rem; | ||
} | ||
|
||
.dnb-anchor--active { | ||
color: var(--sb-color-text); | ||
background-color: var(--sb-color-green); | ||
|
||
border-radius: 0.5rem; | ||
} | ||
|
||
.dnb-anchor--focus { | ||
&:not(:active) { | ||
color: var(--sb-color-blue-dark); | ||
background-color: var(--sb-color-blue-light-3); | ||
|
||
border-radius: 0.25rem; | ||
} | ||
} | ||
|
||
// TODO: add correct contrast styling when designs are in place | ||
.dnb-anchor--contrast { | ||
@include anchor-mixins.useAnchorContrastStyle(); | ||
} |
Binary file modified
BIN
+357 Bytes
(100%)
...ots__/paragraph-with-sbanken-theme-have-to-match-the-paragraph-example.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+132 Bytes
(100%)
...ith-sbanken-theme-have-to-match-the-paragraph-with-additional-elements.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+482 Bytes
(100%)
...ragraph-with-sbanken-theme-have-to-match-the-paragraph-with-small-text.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can try to enable this test, also for UI. We can do this also in a follow up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, lets do it in a follow-up PR 👍