Skip to content

Commit

Permalink
feat(FormLabel): sbanken (#2563)
Browse files Browse the repository at this point in the history
## Summary

Sbanken styling of labels
  • Loading branch information
snorrekim authored Aug 23, 2023
1 parent 06eb04a commit 308a0b6
Show file tree
Hide file tree
Showing 61 changed files with 43 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ description: 'The FormLabel component represents a caption for all sorts of HTML
showTabs: true
hideTabs:
- title: Events
theme: 'sbanken'
---

import FormLabelInfo from 'Docs/uilib/components/form-label/info'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ describe.each(['ui', 'sbanken'])(
simulateSelector:
'[data-visual-test="anchor-blank"] a.dnb-anchor',
simulate: 'hover',
waitAfterSimulate: 200,
})
expect(screenshot).toMatchImageSnapshot()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,6 @@ html[data-visual-test] .dnb-tooltip--hide {
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down Expand Up @@ -1914,7 +1913,6 @@ button.dnb-button::-moz-focus-inner {
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ exports[`Checkbox scss has to match style dependencies css 1`] = `
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,6 @@ html[data-visual-test] .dnb-tooltip--hide {
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down Expand Up @@ -1828,7 +1827,6 @@ button.dnb-button::-moz-focus-inner {
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down Expand Up @@ -2422,7 +2420,6 @@ button.dnb-button::-moz-focus-inner {
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down Expand Up @@ -2702,7 +2699,6 @@ html[data-whatinput=keyboard] .dnb-checkbox__focus {
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down Expand Up @@ -3248,7 +3244,6 @@ button .dnb-form-status__text {
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,6 @@ button.dnb-button::-moz-focus-inner {
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ import {
setupPageScreenshot,
} from '../../../core/jest/jestSetupScreenshots'

describe('FormLabel', () => {
setupPageScreenshot({ url: '/uilib/components/form-label/demos' })
describe.each(['ui', 'sbanken'])('FormLabel for %s', (themeName) => {
setupPageScreenshot({
themeName,
url: '/uilib/components/form-label/demos',
})

it('have to match default form-label', async () => {
const screenshot = await makeScreenshot({
Expand All @@ -26,6 +29,16 @@ describe('FormLabel', () => {
expect(screenshot).toMatchImageSnapshot()
})

it('have to match checkbox label hover', async () => {
const screenshot = await makeScreenshot({
selector: '[data-visual-test="form-label-default"]',
simulate: 'hover',
simulateSelector:
'[data-visual-test="form-label-default"] .dnb-checkbox .dnb-form-label',
})
expect(screenshot).toMatchImageSnapshot()
})

it('have to match vertical form-label', async () => {
const screenshot = await makeScreenshot({
selector: '[data-visual-test="form-label-vertical"]',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ exports[`FormLabel scss has to match style dependencies css 1`] = `
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand All @@ -53,6 +52,9 @@ exports[`FormLabel scss have to match default theme snapshot 1`] = `
.dnb-form-label {
color: var(--color-black-80);
}
.dnb-form-label[for]:not([disabled]) {
cursor: pointer;
}
.dnb-form-label[for]:not([disabled]):hover {
color: var(--color-sea-green);
}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

&[for]:not([disabled]) {
user-select: none; // Safari / Touch fix
cursor: pointer;
}

&[disabled] {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* FormLabel theme
*
*/

.dnb-form-label {
color: var(--sb-color-text);

.dnb-checkbox &,
.dnb-switch &,
.dnb-radio & {
&[for]:not([disabled]) {
cursor: pointer;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
.dnb-form-label {
color: var(--color-black-80);

&[for]:not([disabled]):hover {
color: var(--color-sea-green);
&[for]:not([disabled]) {
cursor: pointer;

&:hover {
color: var(--color-sea-green);
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,6 @@ html[data-visual-test] .dnb-tooltip--hide {
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,6 @@ html[data-visual-test] .dnb-tooltip--hide {
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ exports[`Radio scss has to match style dependencies css 1`] = `
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,6 @@ html[data-visual-test] .dnb-tooltip--hide {
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ exports[`Switch scss has to match style dependencies css 1`] = `
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ exports[`Textarea scss has to match style dependencies css 1`] = `
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ exports[`ToggleButton scss has to match style dependencies css 1`] = `
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down Expand Up @@ -635,7 +634,6 @@ button.dnb-button::-moz-focus-inner {
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down Expand Up @@ -915,7 +913,6 @@ html[data-whatinput=keyboard] .dnb-checkbox__focus {
}
.dnb-form-label[for]:not([disabled]) {
user-select: none;
cursor: pointer;
}
.dnb-form-label[disabled] {
cursor: not-allowed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ $fonts-path: '../../../../assets/fonts/dnb' !default;
@import '../../../components/anchor/style/themes/dnb-anchor-theme-sbanken.scss';
@import '../../../components/avatar/style/themes/dnb-avatar-theme-sbanken.scss';
@import '../../../components/button/style/themes/dnb-button-theme-sbanken.scss';
@import '../../../components/form-label/style/themes/dnb-form-label-theme-sbanken.scss';
@import '../../../components/input/style/themes/dnb-input-theme-sbanken.scss';
@import '../../../components/logo/style/themes/dnb-logo-theme-sbanken.scss';
@import '../../../components/pagination/style/themes/dnb-pagination-theme-sbanken.scss';
Expand All @@ -33,7 +34,6 @@ $fonts-path: '../../../../assets/fonts/dnb' !default;
@import '../../../components/dialog/style/themes/dnb-dialog-theme-ui.scss';
@import '../../../components/drawer/style/themes/dnb-drawer-theme-ui.scss';
@import '../../../components/dropdown/style/themes/dnb-dropdown-theme-ui.scss';
@import '../../../components/form-label/style/themes/dnb-form-label-theme-ui.scss';
@import '../../../components/form-row/style/themes/dnb-form-row-theme-ui.scss';
@import '../../../components/form-set/style/themes/dnb-form-set-theme-ui.scss';
@import '../../../components/form-status/style/themes/dnb-form-status-theme-ui.scss';
Expand Down

1 comment on commit 308a0b6

@vercel
Copy link

@vercel vercel bot commented on 308a0b6 Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.