feat: integrate Universal Design System with Web, Print, and Presentation examples
Some checks failed
Monorepo Pipeline / ⚡ Prioritize Release (push) Successful in 2s
Monorepo Pipeline / 🧪 Test (push) Successful in 1m16s
Monorepo Pipeline / 🧹 Lint (push) Failing after 1m27s
Monorepo Pipeline / 🏗️ Build (push) Failing after 1m29s
Monorepo Pipeline / 🚀 Release (push) Has been skipped
Monorepo Pipeline / 🐳 Build Gatekeeper (Product) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Build-Base (push) Has been skipped
Monorepo Pipeline / 🐳 Build Production Runtime (push) Has been skipped

This commit is contained in:
2026-06-08 17:55:57 +02:00
parent 9f8eab2ad2
commit 599ca63f06
47 changed files with 10864 additions and 200 deletions

26
packages/ui/package.json Normal file
View File

@@ -0,0 +1,26 @@
{
"name": "@mintel/ui",
"version": "1.0.0",
"private": true,
"main": "./src/index.ts",
"types": "./src/index.ts",
"scripts": {
"ladle": "ladle serve",
"build": "ladle build"
},
"dependencies": {
"@react-pdf/renderer": "^3.4.0",
"framer-motion": "^11.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@ladle/react": "^4.0.0",
"tailwindcss": "^3.4.0",
"postcss": "^8.4.0",
"autoprefixer": "^10.4.0",
"typescript": "^5.0.0",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0"
}
}

View File

@@ -0,0 +1,24 @@
import React from 'react';
import { View } from '@react-pdf/renderer';
import { motion, HTMLMotionProps } from 'framer-motion';
import { useEnvironment } from '../context/EnvironmentContext';
export interface BoxProps extends HTMLMotionProps<"div"> {
children?: React.ReactNode;
pdfStyle?: any; // Specifically for PDF if Tailwind mapping is not enough
}
export const Box: React.FC<BoxProps> = ({ children, className, style, pdfStyle, ...props }) => {
const env = useEnvironment();
if (env === 'print') {
return <View style={pdfStyle || style}>{children}</View>;
}
// Web and Presentation get Framer Motion by default
return (
<motion.div className={className} style={style} {...props}>
{children}
</motion.div>
);
};

View File

@@ -0,0 +1,23 @@
import React from 'react';
import { Text as PdfText } from '@react-pdf/renderer';
import { motion, HTMLMotionProps } from 'framer-motion';
import { useEnvironment } from '../context/EnvironmentContext';
export interface TextProps extends HTMLMotionProps<"span"> {
children?: React.ReactNode;
pdfStyle?: any;
}
export const Text: React.FC<TextProps> = ({ children, className, style, pdfStyle, ...props }) => {
const env = useEnvironment();
if (env === 'print') {
return <PdfText style={pdfStyle || style}>{children}</PdfText>;
}
return (
<motion.span className={className} style={style} {...props}>
{children}
</motion.span>
);
};

View File

@@ -0,0 +1,17 @@
import React, { createContext, useContext } from 'react';
export type Environment = 'web' | 'print' | 'presentation';
const EnvironmentContext = createContext<Environment>('web');
export const EnvironmentProvider: React.FC<{ env: Environment; children: React.ReactNode }> = ({ env, children }) => {
return (
<EnvironmentContext.Provider value={env}>
{children}
</EnvironmentContext.Provider>
);
};
export const useEnvironment = () => {
return useContext(EnvironmentContext);
};

3
packages/ui/src/index.ts Normal file
View File

@@ -0,0 +1,3 @@
export { Box } from './components/universal/Box';
export { Text } from './components/universal/Text';
export { EnvironmentProvider, useEnvironment } from './context/EnvironmentContext';

View File

@@ -0,0 +1,17 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./src/**/*.{js,jsx,ts,tsx}",
],
theme: {
extend: {
colors: {
mintel: {
primary: '#1E40AF',
accent: '#82ed20',
}
}
},
},
plugins: [],
}