@nordcom/nordstar-system
Advanced tools
Comparing version 0.0.17 to 0.0.18-unstable-20231208102640
@@ -36,4 +36,4 @@ import type { ReactNode } from 'react'; | ||
export type NordstarProviderProps = { | ||
theme?: NordstarTheme; | ||
children: ReactNode; | ||
theme?: NordstarTheme; | ||
}; | ||
@@ -49,2 +49,2 @@ /** | ||
*/ | ||
export declare const NordstarProvider: ({ children, theme }: NordstarProviderProps) => import("react").JSX.Element; | ||
export declare const NordstarProvider: ({ children, theme, ...props }: NordstarProviderProps) => import("react/jsx-runtime").JSX.Element; |
import './nordstar-provider.css'; | ||
import { jsx } from 'react/jsx-runtime'; | ||
import { jsxs, Fragment, jsx } from 'react/jsx-runtime'; | ||
@@ -9,29 +9,36 @@ const container = "_container_147gv_1"; | ||
const NordstarProvider = ({ children, theme }) => { | ||
const { accents, fonts, sizes, layout } = theme ?? {}; | ||
const style = { | ||
// Colors. | ||
"--color-accent-primary": accents?.primary, | ||
"--color-accent-secondary": accents?.secondary, | ||
// Fonts. | ||
...fonts?.heading && { "--font-heading": fonts.heading }, | ||
...fonts?.body && { | ||
"--font-body": fonts.body, | ||
fontFamily: `var('--font-body')` | ||
}, | ||
// Sizes. | ||
"--size-text-body": sizes?.text?.body || "14px", | ||
// Border. | ||
"--border-width": theme?.border?.width || "0.18rem", | ||
"--border-radius": theme?.border?.radius || "0.5rem", | ||
// Layout.Page. | ||
"--layout-page-width": layout?.page?.width || "1200px", | ||
"--layout-page-spacing": layout?.page?.spacing || "1rem", | ||
// Layout.Section. | ||
"--layout-section-spacing": layout?.section?.spacing || "1rem", | ||
"--layout-section-padding": layout?.section?.padding || "1.75rem", | ||
// Layout.Block. | ||
"--layout-block-padding": layout?.block?.padding || "1rem" | ||
}; | ||
return /* @__PURE__ */ jsx("div", { id: "nordstar", role: "document", style, className: styles.container, children }); | ||
const NordstarProvider = ({ children, theme, ...props }) => { | ||
const { accents, fonts, sizes, layout } = theme || {}; | ||
const headingFont = fonts?.heading || fonts?.body ? `--font-heading: ${(fonts.heading || fonts.body).replaceAll("'", "")};` : ""; | ||
const bodyFont = fonts?.body || fonts?.heading ? `--font-body: ${(fonts.body || fonts.heading).replaceAll("'", "")};` : ""; | ||
const css = ` | ||
:root { | ||
--color-accent-primary: ${accents?.primary}; | ||
--color-accent-secondary: ${accents?.secondary}; | ||
--color-background: #000000; | ||
--color-background-highlight: #262626; | ||
--color-foreground: #fefefe; | ||
--color-foreground-secondary: #828282; | ||
${headingFont} | ||
${bodyFont} | ||
--size-text-body: ${sizes?.text?.body || "14px"}; | ||
--border-width: ${theme?.border?.width || "0.18rem"}; | ||
--border-radius: ${theme?.border?.radius || "0.5rem"}; | ||
--layout-page-width: ${layout?.page?.width || "1200px"}; | ||
--layout-page-spacing: ${layout?.page?.spacing || "1rem"}; | ||
--layout-section-spacing: ${layout?.section?.spacing || "1rem"}; | ||
--layout-section-padding: ${layout?.section?.padding || "1.75rem"}; | ||
--layout-block-padding: ${layout?.block?.padding || "1rem"}; | ||
} | ||
`; | ||
return /* @__PURE__ */ jsxs(Fragment, { children: [ | ||
/* @__PURE__ */ jsx("style", { ...props, children: css }), | ||
/* @__PURE__ */ jsx("div", { id: "nordstar", role: "document", className: styles.container || "", children }) | ||
] }); | ||
}; | ||
@@ -38,0 +45,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"type": "module", | ||
"version": "0.0.17", | ||
"version": "0.0.18-unstable-20231208102640", | ||
"description": "", | ||
@@ -8,0 +8,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8683
166