-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into bugfix/combobox-with-autocomplete-unwanted-s…
…crolling-while-typing
- Loading branch information
Showing
281 changed files
with
11,022 additions
and
1,970 deletions.
There are no files selected for viewing
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
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
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
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,9 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
CHANGED=`git diff $1 $2 --stat -- yarn.lock | wc -l` | ||
if [ $CHANGED -gt 0 ]; | ||
then | ||
echo | ||
echo "*** 🟡 yarn.lock has changed 🟡 ***" | ||
fi |
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,9 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
CHANGED=`git diff HEAD@{1} --stat -- yarn.lock | wc -l` | ||
if [ $CHANGED -gt 0 ]; | ||
then | ||
echo | ||
echo "*** 🟡 yarn.lock has changed 🟡 ***" | ||
fi |
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 was deleted.
Oops, something went wrong.
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,128 @@ | ||
import { withThemeByClassName } from "@storybook/addon-themes"; | ||
import { Preview } from "@storybook/react"; | ||
import React, { useLayoutEffect } from "react"; | ||
// @ts-expect-error - Temporary | ||
import darksideCss from "@navikt/ds-css/darkside/index.css?inline"; | ||
// @ts-expect-error - Temporary | ||
import defaultCss from "@navikt/ds-css/index.css?inline"; | ||
import { UNSAFE_AkselTheme } from "../@navikt/core/react/src/provider"; | ||
import UNSAFE_AkselLanguageProvider from "../@navikt/core/react/src/provider/i18n/LanguageProvider"; | ||
import en from "../@navikt/core/react/src/util/i18n/locales/en"; | ||
import nb from "../@navikt/core/react/src/util/i18n/locales/nb"; | ||
import nn from "../@navikt/core/react/src/util/i18n/locales/nn"; | ||
import "./layout.css"; | ||
|
||
const ModeDecorator = ({ children, mode, theme }) => { | ||
useLayoutEffect(() => { | ||
const style = document.createElement("style"); | ||
style.innerHTML = mode === "darkside" ? darksideCss : defaultCss; | ||
document.head.appendChild(style); | ||
|
||
if (mode === "darkside") { | ||
document.body.style.setProperty("background", "var(--ax-bg-default)"); | ||
} | ||
|
||
return () => { | ||
document.head.removeChild(style); | ||
document.body.style.removeProperty("background"); | ||
}; | ||
}, [mode]); | ||
|
||
return mode === "darkside" ? ( | ||
<UNSAFE_AkselTheme theme={theme || undefined} hasBackground={false}> | ||
{children} | ||
</UNSAFE_AkselTheme> | ||
) : ( | ||
children | ||
); | ||
}; | ||
|
||
const translations = { | ||
nb, | ||
nn, | ||
en, | ||
}; | ||
|
||
const LanguageDecorator = ({ children, language }) => { | ||
if (language) { | ||
return ( | ||
<UNSAFE_AkselLanguageProvider translations={translations[language]}> | ||
{children} | ||
</UNSAFE_AkselLanguageProvider> | ||
); | ||
} | ||
return children; | ||
}; | ||
|
||
export default { | ||
parameters: { | ||
options: { | ||
storySort: { | ||
method: "alphabetical", | ||
order: [ | ||
"Getting started", | ||
"ds-react", | ||
["Primitives"], | ||
["Default", "Controls"], | ||
"Aksel-icons", | ||
], | ||
}, | ||
}, | ||
layout: "centered", | ||
backgrounds: { disable: true }, | ||
}, | ||
|
||
globalTypes: { | ||
mode: { | ||
name: "Darkside", | ||
toolbar: { | ||
items: [ | ||
{ | ||
value: "default", | ||
icon: "hourglass", | ||
title: "Default (old)", | ||
}, | ||
{ value: "darkside", icon: "beaker", title: "Darkside (new)" }, | ||
], | ||
showName: true, | ||
dynamicTitle: true, | ||
}, | ||
}, | ||
language: { | ||
toolbar: { | ||
icon: "globe", | ||
items: [ | ||
{ value: undefined, title: "Unset" }, | ||
{ value: "nb", right: "🇳🇴", title: "Norsk bokmål" }, | ||
{ value: "nn", right: "🇳🇴", title: "Norsk nynorsk" }, | ||
{ value: "en", right: "🇬🇧", title: "English" }, | ||
], | ||
dynamicTitle: true, | ||
}, | ||
}, | ||
}, | ||
|
||
initialGlobals: { | ||
mode: "default", | ||
}, | ||
|
||
decorators: [ | ||
(StoryFn, context) => ( | ||
<ModeDecorator mode={context.globals.mode} theme={context.globals.theme}> | ||
<StoryFn /> | ||
</ModeDecorator> | ||
), | ||
(StoryFn, context) => ( | ||
<LanguageDecorator language={context.globals.language}> | ||
<StoryFn /> | ||
</LanguageDecorator> | ||
), | ||
withThemeByClassName({ | ||
themes: { | ||
light: "light", | ||
dark: "dark", | ||
}, | ||
defaultTheme: "light", | ||
}), | ||
], | ||
} satisfies Preview; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.