Skip to content

Commit

Permalink
📦 #23 - build: fix project build structure
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvandescheur committed Jan 30, 2024
1 parent 9409310 commit fedef4b
Show file tree
Hide file tree
Showing 25 changed files with 34 additions and 115 deletions.
2 changes: 2 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { Preview } from "@storybook/react";
import * as React from "react";

import "../src/settings/tokens.css";

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
Expand Down
59 changes: 0 additions & 59 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"devDependencies": {
"@commitlint/cli": "^18.4.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.5",
"@storybook/addon-essentials": "^7.6.7",
Expand Down
5 changes: 2 additions & 3 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import terser from "@rollup/plugin-terser";
import typescript from "@rollup/plugin-typescript";
import peerDepsExternal from "rollup-plugin-peer-deps-external";
Expand All @@ -8,17 +7,17 @@ import postcss_url from "postcss-url";

export default [
{
external: ["@floating-ui/react", "@heroicons/react/24/outline", "@heroicons/react/24/solid", "clsx"],
input: "src/index.tsx",
output: {
dir: "dist",
format: "esm",
format: "cjs",
sourcemap: true,
preserveModules: true,
},
plugins: [
peerDepsExternal(),
commonjs(),
resolve(),
typescript({ tsconfig: "./tsconfig.json" }),
postcss({
autoModules: true,
Expand Down
2 changes: 0 additions & 2 deletions src/components/boolean/boolean.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import "../../settings/style";

.mykn-boolean {
align-items: center;
border-radius: var(--border-radus-m);
Expand Down
2 changes: 0 additions & 2 deletions src/components/button/button.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@use "../../settings/style";

.mykn-button {
--mykn-button-color-background: var(--theme-color-primary-800);
--mykn-button-color-shadow: var(--theme-shade-1000);
Expand Down
8 changes: 4 additions & 4 deletions src/components/dropdown/dropdown.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use "../../settings/style";
@use "../../settings/constants";

.mykn-dropdown {
display: inline-flex;
Expand All @@ -24,20 +24,20 @@
z-index: 1000;
}

@media screen and (max-width: style.$breakpoint-desktop - 1px) {
@media screen and (max-width: constants.$breakpoint-desktop - 1px) {
&__dropdown {
width: 100%; // Fallback.
width: min(100%, max(calc(100vw - 2 * var(--spacing-h-xl)), 100cqw));
}
}

@media screen and (min-width: style.$breakpoint-desktop) {
@media screen and (min-width: constants.$breakpoint-desktop) {
&__dropdown .mykn-toolbar--direction-horizontal {
width: min-content;
}
}

@media screen and (min-width: style.$breakpoint-desktop) {
@media screen and (min-width: constants.$breakpoint-desktop) {
&__dropdown .mykn-toolbar--direction-vertical {
width: max-content;
}
Expand Down
2 changes: 0 additions & 2 deletions src/components/form/select/select.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@use "../../../settings/style";

.mykn-select {
align-items: center;
background: var(--typography-color-background);
Expand Down
7 changes: 3 additions & 4 deletions src/components/layout/column/column.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use "../../../settings/style";
@use "../../../settings/constants";

.mykn-column {
grid-column: auto / 6 span;
Expand All @@ -16,10 +16,10 @@
}

&--debug[data-testid]:before {
content: attr(data-testid)!important;
content: attr(data-testid) !important;
}

@media screen and (min-width: style.$breakpoint-desktop) {
@media screen and (min-width: constants.$breakpoint-desktop) {
@for $i from 1 through 12 {
&--span-#{$i} {
grid-column: auto / span #{$i};
Expand All @@ -31,4 +31,3 @@
}
}
}

4 changes: 2 additions & 2 deletions src/components/layout/grid/grid.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use "../../../settings/style";
@use "../../../settings/constants";

.mykn-grid {
display: grid;
Expand All @@ -23,7 +23,7 @@
content: attr(data-testid);
}

@media screen and (min-width: style.$breakpoint-desktop) {
@media screen and (min-width: constants.$breakpoint-desktop) {
& {
grid-template-columns: repeat(12, auto);
gap: var(--gutter-v-desktop) var(--gutter-h-desktop);
Expand Down
4 changes: 2 additions & 2 deletions src/components/page/page.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use '../../settings/style';
@use "../../settings/constants";

.mykn-page {
background-color: var(--theme-color-primary-200);
Expand All @@ -9,7 +9,7 @@
width: 100%;
height: 100%;

@media screen and (min-width: style.$breakpoint-desktop) {
@media screen and (min-width: constants.$breakpoint-desktop) {
padding: var(--spacing-v-xl) var(--spacing-h-xl);
}
}
4 changes: 2 additions & 2 deletions src/components/paginator/paginator.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use "../../settings/style";
@use "../../settings/constants";

.mykn-paginator {
display: flex;
Expand All @@ -11,7 +11,7 @@
gap: var(--spacing-h-m);
}

@media screen and (max-width: style.$breakpoint-desktop - 1px) {
@media screen and (max-width: constants.$breakpoint-desktop - 1px) {
&__section {
width: 100%;

Expand Down
6 changes: 3 additions & 3 deletions src/components/toolbar/toolbar.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use "../../settings/style";
@use "../../settings/constants";

.mykn-toolbar {
$self: &;
Expand All @@ -15,15 +15,15 @@
background-color: transparent;
}

@media screen and (max-width: style.$breakpoint-desktop - 1px) {
@media screen and (max-width: constants.$breakpoint-desktop - 1px) {
.mykn-a,
.mykn-button,
.mykn-dropdown {
justify-content: start;
}
}

@media screen and (min-width: style.$breakpoint-desktop) {
@media screen and (min-width: constants.$breakpoint-desktop) {
&--align-start {
align-items: start;
justify-content: start;
Expand Down
2 changes: 0 additions & 2 deletions src/components/typography/body/body.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@use "../../../settings/style";

.mykn-body {
.mykn-h1,
.mykn-h2,
Expand Down
2 changes: 0 additions & 2 deletions src/components/typography/h1/h1.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@use "../../../settings/style";

.mykn-h1 {
color: var(--typography-color-h);
font-family: Inter, sans-serif;
Expand Down
2 changes: 0 additions & 2 deletions src/components/typography/h2/h2.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@use "../../../settings/style";

.mykn-h2 {
color: var(--typography-color-h);
font-family: Inter, sans-serif;
Expand Down
2 changes: 0 additions & 2 deletions src/components/typography/h3/h3.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@use "../../../settings/style";

.mykn-h3 {
color: var(--typography-color-h);
font-family: Inter, sans-serif;
Expand Down
2 changes: 0 additions & 2 deletions src/components/typography/hr/hr.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@use '../../../settings/style';

.mykn-hr {
border: 0;
border-bottom: 1px solid var(--theme-shade-300);
Expand Down
5 changes: 2 additions & 3 deletions src/components/typography/li/li.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@use "../../../settings/style";
@use '../p/p';
@use "../p/p";

.mykn-li {
@extend .mykn-p
@extend .mykn-p;
}
6 changes: 3 additions & 3 deletions src/components/typography/ol/ol.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@use "../../../settings/style";
@use '../p/p';
@use "../p/p";

.mykn-ol {
@extend .mykn-p;
Expand All @@ -8,4 +7,5 @@

.mykn-ol {
padding-inline-start: var(--spacing-h-xl);
}}
}
}
2 changes: 0 additions & 2 deletions src/components/typography/p/p.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@use "../../../settings/style";

.mykn-p {
color: var(--typography-color-body);
font-family: Inter, sans-serif;
Expand Down
3 changes: 1 addition & 2 deletions src/components/typography/ul/ul.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@use "../../../settings/style";
@use '../p/p';
@use "../p/p";

.mykn-ul {
@extend .mykn-p;
Expand Down
2 changes: 2 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
import "./settings/tokens.css";

export * from "./components";
1 change: 1 addition & 0 deletions src/settings/_constants.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$breakpoint-desktop: 768px;
14 changes: 5 additions & 9 deletions src/settings/_style.scss → src/settings/tokens.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/// USE CSS VARIABLES WHERE POSSIBLE
:root {
/// ANIMATION
/* ANIMATION */
--animation-timing-function: ease-in-out;
--animation-duration-fast: 0.1s;
--animation-duration-medium: 0.3s;
--animation-duration-slow: 1s;

/// THEME
/* THEME */
--theme-color-primary-800: #341a90;
--theme-color-primary-700: #5422b9;
--theme-color-primary-600: #8d75e6;
Expand All @@ -31,7 +30,7 @@
--theme-color-danger-body: #ff4545;
--theme-color-danger-background: #{rgba(#ff4545, 0.1)};

/// SPACING
/* SPACING */
--border-radus-l: 12px;
--border-radus-m: 6px;

Expand All @@ -53,7 +52,7 @@
--spacing-h-xxl: 32px;
--spacing-v-xxl: 32px;

/// TYPOGRAPHY
/* TYPOGRAPHY */
--typography-color-background: var(--theme-shade-0);
--typography-color-h: var(--theme-shade-900);
--typography-color-body: var(--theme-shade-700);
Expand All @@ -75,10 +74,7 @@
--typography-line-height-body-xs: 24px;
}

/// SASS CONSTANTS AS FALLBACK
$breakpoint-desktop: 768px;

/// ASSETS
/* ASSETS */
@font-face {
font-family: "Inter";
font-style: normal;
Expand Down

0 comments on commit fedef4b

Please sign in to comment.