Skip to content
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([DST-120]): expose preset from themes #3249

Merged
merged 6 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions pnpm-lock.yaml

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

10 changes: 6 additions & 4 deletions themes/theme-b2b/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
"./index.css": "./dist/index.css"
"./index.css": "./dist/index.css",
"./preset": "./dist/preset.mjs",
"./preset/cjs": "./dist/preset.js"
},
"sideEffects": false,
"files": [
Expand All @@ -25,17 +27,17 @@
"directory": "packages/theme-b2b"
},
"devDependencies": {
"@marigold/theme-preset": "workspace:*",
"@marigold/tsconfig": "workspace:*",
"autoprefixer": "10.4.14",
"cssnano": "6.0.1",
"postcss": "8.4.26",
"tailwindcss": "3.3.3",
"tsup": "6.7.0"
},
"peerDependencies": {
"dependencies": {
"@marigold/components": "workspace:*",
"@marigold/system": "workspace:*"
"@marigold/system": "workspace:*",
"@marigold/theme-preset": "workspace:*"
},
"scripts": {
"build": "NODE_ENV=production tsup",
Expand Down
11 changes: 7 additions & 4 deletions themes/theme-b2b/src/preset.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import { createPreset } from '@marigold/theme-preset';

import { theme } from './theme';
import { screens } from './screens';
import { colors } from './tokens';

export interface PresetConfig {
name: string;
preflight?: boolean;
}

export const preset = createPreset('b2b', {
export type Preset = ReturnType<typeof createPreset>;

export const preset: Preset = createPreset('b2b', {
// corePlugins: {
// preflight: false,
// },
theme: {
extend: {
screens: theme.screens,
screens,
fontFamily: {
body: ['Inter, sans-serif'],
heading: ['"Inter Black, sans-serif"'],
},
colors: theme.colors,
colors,
transitionTimingFunction: {
'ease-out': 'ease-out',
},
Expand Down
7 changes: 7 additions & 0 deletions themes/theme-b2b/src/screens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const screens = {
sm: '640px',
md: '768px',
lg: '1024px',
xl: '1280px',
'2xl': '1536px',
};
9 changes: 2 additions & 7 deletions themes/theme-b2b/src/theme.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import { Theme } from '@marigold/system';

import { root } from './root';
import { screens } from './screens';
import { colors } from './tokens';

import * as components from './components';

export const theme: Theme = {
name: 'b2b',
screens: {
sm: '640px',
md: '768px',
lg: '1024px',
xl: '1280px',
'2xl': '1536px',
},
screens,
root,
colors,
components,
Expand Down
2 changes: 1 addition & 1 deletion themes/theme-b2b/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from 'tsup';

export default defineConfig({
entry: ['src/index.ts', 'src/index.css'],
entry: ['src/index.ts', 'src/index.css', 'src/preset.ts'],
format: ['esm', 'cjs'],
tsconfig: './tsconfig.build.json',
dts: true,
Expand Down
10 changes: 6 additions & 4 deletions themes/theme-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
"./index.css": "./dist/index.css"
"./index.css": "./dist/index.css",
"./preset": "./dist/preset.mjs",
"./preset/cjs": "./dist/preset.js"
},
"sideEffects": false,
"files": [
Expand All @@ -25,17 +27,17 @@
"directory": "packages/theme-core"
},
"devDependencies": {
"@marigold/theme-preset": "workspace:*",
"@marigold/tsconfig": "workspace:*",
"autoprefixer": "10.4.14",
"cssnano": "6.0.1",
"postcss": "8.4.26",
"tailwindcss": "3.3.3",
"tsup": "6.7.0"
},
"peerDependencies": {
"dependencies": {
"@marigold/components": "workspace:*",
"@marigold/system": "workspace:*"
"@marigold/system": "workspace:*",
"@marigold/theme-preset": "workspace:*"
},
"scripts": {
"build": "NODE_ENV=production tsup",
Expand Down
11 changes: 7 additions & 4 deletions themes/theme-core/src/preset.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
import { createPreset } from '@marigold/theme-preset';

import { theme } from './theme';
import { screens } from './screens';
import { colors } from './tokens';

export interface PresetConfig {
name: string;
preflight?: boolean;
}

export const preset = createPreset('core', {
export type Preset = ReturnType<typeof createPreset>;

export const preset: Preset = createPreset('core', {
corePlugins: {
preflight: false,
},
theme: {
extend: {
screens: theme.screens,
screens,
fontFamily: {
body: 'Arial, Helvetica, sans-serif',
},
fontSize: {
body: '13px',
},
colors: theme.colors,
colors,
transitionTimingFunction: {
'ease-out': 'ease-out',
},
Expand Down
7 changes: 7 additions & 0 deletions themes/theme-core/src/screens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const screens = {
sm: '640px',
md: '768px',
lg: '1024px',
xl: '1280px',
'2xl': '1536px',
};
16 changes: 6 additions & 10 deletions themes/theme-core/src/theme.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import { Theme } from '@marigold/system';
import { colors } from './tokens';
import * as components from './components';

import { root } from './root';
import { screens } from './screens';
import { colors } from './tokens';

import * as components from './components';

export const theme: Theme = {
name: 'core',
screens: {
sm: '640px',
md: '768px',
lg: '1024px',
xl: '1280px',
'2xl': '1536px',
},
screens,
root,
colors: colors,
colors,
components,
};
2 changes: 1 addition & 1 deletion themes/theme-core/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from 'tsup';

export default defineConfig({
entry: ['src/index.ts', 'src/index.css'],
entry: ['src/index.ts', 'src/index.css', 'src/preset.ts'],
format: ['esm', 'cjs'],
tsconfig: './tsconfig.build.json',
dts: true,
Expand Down