first commit
This commit is contained in:
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
73
README.md
Normal file
73
README.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# React + TypeScript + Vite
|
||||
|
||||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
||||
|
||||
Currently, two official plugins are available:
|
||||
|
||||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
||||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
||||
|
||||
## React Compiler
|
||||
|
||||
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
||||
|
||||
## Expanding the ESLint configuration
|
||||
|
||||
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
||||
|
||||
```js
|
||||
export default defineConfig([
|
||||
globalIgnores(['dist']),
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
extends: [
|
||||
// Other configs...
|
||||
|
||||
// Remove tseslint.configs.recommended and replace with this
|
||||
tseslint.configs.recommendedTypeChecked,
|
||||
// Alternatively, use this for stricter rules
|
||||
tseslint.configs.strictTypeChecked,
|
||||
// Optionally, add this for stylistic rules
|
||||
tseslint.configs.stylisticTypeChecked,
|
||||
|
||||
// Other configs...
|
||||
],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
// other options...
|
||||
},
|
||||
},
|
||||
])
|
||||
```
|
||||
|
||||
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
||||
|
||||
```js
|
||||
// eslint.config.js
|
||||
import reactX from 'eslint-plugin-react-x'
|
||||
import reactDom from 'eslint-plugin-react-dom'
|
||||
|
||||
export default defineConfig([
|
||||
globalIgnores(['dist']),
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
extends: [
|
||||
// Other configs...
|
||||
// Enable lint rules for React
|
||||
reactX.configs['recommended-typescript'],
|
||||
// Enable lint rules for React DOM
|
||||
reactDom.configs.recommended,
|
||||
],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
// other options...
|
||||
},
|
||||
},
|
||||
])
|
||||
```
|
||||
23
eslint.config.js
Normal file
23
eslint.config.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import js from '@eslint/js'
|
||||
import globals from 'globals'
|
||||
import reactHooks from 'eslint-plugin-react-hooks'
|
||||
import reactRefresh from 'eslint-plugin-react-refresh'
|
||||
import tseslint from 'typescript-eslint'
|
||||
import { defineConfig, globalIgnores } from 'eslint/config'
|
||||
|
||||
export default defineConfig([
|
||||
globalIgnores(['dist']),
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
extends: [
|
||||
js.configs.recommended,
|
||||
tseslint.configs.recommended,
|
||||
reactHooks.configs.flat.recommended,
|
||||
reactRefresh.configs.vite,
|
||||
],
|
||||
languageOptions: {
|
||||
ecmaVersion: 2020,
|
||||
globals: globals.browser,
|
||||
},
|
||||
},
|
||||
])
|
||||
13
index.html
Normal file
13
index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>newsletter-app</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
3857
package-lock.json
generated
Normal file
3857
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
35
package.json
Normal file
35
package.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "newsletter-app",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc -b && vite build",
|
||||
"lint": "eslint .",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tailwindcss/postcss": "^4.1.18",
|
||||
"lucide-react": "^0.561.0",
|
||||
"react": "^19.2.0",
|
||||
"react-dom": "^19.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.39.1",
|
||||
"@types/node": "^24.10.1",
|
||||
"@types/react": "^19.2.5",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^5.1.1",
|
||||
"autoprefixer": "^10.4.23",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"eslint-plugin-react-refresh": "^0.4.24",
|
||||
"globals": "^16.5.0",
|
||||
"postcss": "^8.5.6",
|
||||
"tailwindcss": "^4.1.18",
|
||||
"typescript": "~5.9.3",
|
||||
"typescript-eslint": "^8.46.4",
|
||||
"vite": "^7.2.4"
|
||||
}
|
||||
}
|
||||
6
postcss.config.js
Normal file
6
postcss.config.js
Normal file
@@ -0,0 +1,6 @@
|
||||
export default {
|
||||
plugins: {
|
||||
'@tailwindcss/postcss': {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
||||
1
public/vite.svg
Normal file
1
public/vite.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
42
src/App.css
Normal file
42
src/App.css
Normal file
@@ -0,0 +1,42 @@
|
||||
#root {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 6em;
|
||||
padding: 1.5em;
|
||||
will-change: filter;
|
||||
transition: filter 300ms;
|
||||
}
|
||||
.logo:hover {
|
||||
filter: drop-shadow(0 0 2em #646cffaa);
|
||||
}
|
||||
.logo.react:hover {
|
||||
filter: drop-shadow(0 0 2em #61dafbaa);
|
||||
}
|
||||
|
||||
@keyframes logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
a:nth-of-type(2) .logo {
|
||||
animation: logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
.read-the-docs {
|
||||
color: #888;
|
||||
}
|
||||
831
src/App.tsx
Normal file
831
src/App.tsx
Normal file
@@ -0,0 +1,831 @@
|
||||
import { useState } from 'react';
|
||||
import { Download, Type, Image as ImageIcon, Layout, MousePointer2, Trash2, Code, AlignLeft, AlignCenter, AlignRight, Loader2, Link as LinkIcon, Smile, Minus, Heading } from 'lucide-react';
|
||||
|
||||
// --- CONFIGURATION & CONSTANTES ---
|
||||
const DEFAULT_WIDTH = "600";
|
||||
const ORANGE_COLOR = "#f37037";
|
||||
const PURPLE_COLOR = "#800080";
|
||||
|
||||
const FONT_OPTIONS = {
|
||||
sans: { label: 'Standard (Arial)', value: 'Helvetica, Arial, sans-serif' },
|
||||
serif: { label: 'Sérif (Times)', value: 'Georgia, "Times New Roman", serif' },
|
||||
luckiest: { label: 'Luckiest Guy (Bulletin)', value: "'Luckiest Guy', cursive" },
|
||||
roboto: { label: 'Roboto (Moderne)', value: "'Roboto', sans-serif" },
|
||||
open: { label: 'Open Sans (Neutre)', value: "'Open Sans', sans-serif" }
|
||||
};
|
||||
|
||||
// Types pour TypeScript
|
||||
interface Block {
|
||||
id: string;
|
||||
type: string;
|
||||
[key: string]: any; // Permet d'accéder à n'importe quelle propriété dynamiquement
|
||||
}
|
||||
|
||||
// Modèles de blocs par défaut
|
||||
const BLOCK_TEMPLATES: Record<string, any> = {
|
||||
header: {
|
||||
id: null,
|
||||
type: 'header',
|
||||
content: "BULLETIN MENSUEL\nD'INFORMATIONS SYNDiCALES",
|
||||
subtitle: 'AUTOMNE 2025',
|
||||
bgColor: '#eeeeee',
|
||||
backgroundImage: '', // Nouveau champ image de fond
|
||||
textColor: PURPLE_COLOR,
|
||||
subtitleColor: ORANGE_COLOR,
|
||||
padding: '30',
|
||||
align: 'center',
|
||||
fontSize: '42',
|
||||
subtitleFontSize: '24',
|
||||
fontFamily: FONT_OPTIONS.luckiest.value,
|
||||
decoration: {
|
||||
enabled: true,
|
||||
content: '!',
|
||||
color: ORANGE_COLOR,
|
||||
size: '80',
|
||||
rotation: '15',
|
||||
xOffset: '220',
|
||||
yOffset: '-15'
|
||||
}
|
||||
},
|
||||
title: {
|
||||
id: null,
|
||||
type: 'title',
|
||||
content: 'LE TEMPS DES CHÂTAIGNES',
|
||||
bgColor: '#ffffff',
|
||||
textColor: PURPLE_COLOR,
|
||||
padding: '10',
|
||||
align: 'left',
|
||||
fontSize: '20',
|
||||
fontFamily: FONT_OPTIONS.sans.value
|
||||
},
|
||||
text: {
|
||||
id: null,
|
||||
type: 'text',
|
||||
content: 'Les 10 et 18 septembre ainsi que le 2 octobre ont rappelé que la colère ne s’était pas éteinte pendant l’été. Au-delà des chiffres de grève, la dégradation des conditions de travail des personnels de la DGFiP s’accentue.',
|
||||
bgColor: '#ffffff',
|
||||
textColor: '#4a4a4a',
|
||||
padding: '20',
|
||||
align: 'left',
|
||||
fontSize: '16',
|
||||
lineHeight: '1.5',
|
||||
fontFamily: FONT_OPTIONS.sans.value
|
||||
},
|
||||
divider: {
|
||||
id: null,
|
||||
type: 'divider',
|
||||
lineStyle: 'dotted',
|
||||
lineColor: PURPLE_COLOR,
|
||||
thickness: '2',
|
||||
bgColor: '#ffffff',
|
||||
padding: '0'
|
||||
},
|
||||
link: {
|
||||
id: null,
|
||||
type: 'link',
|
||||
content: 'Retour sur les revendications et mobilisations de cette rentrée 2025',
|
||||
url: '#',
|
||||
textColor: ORANGE_COLOR,
|
||||
bgColor: '#ffffff',
|
||||
padding: '10',
|
||||
align: 'right',
|
||||
fontSize: '14',
|
||||
fontFamily: FONT_OPTIONS.sans.value
|
||||
},
|
||||
button: {
|
||||
id: null,
|
||||
type: 'button',
|
||||
content: 'CLIQUEZ ICI',
|
||||
url: '#',
|
||||
btnColor: ORANGE_COLOR,
|
||||
textColor: '#ffffff',
|
||||
bgColor: '#ffffff',
|
||||
padding: '20',
|
||||
align: 'center',
|
||||
borderRadius: '4',
|
||||
width: 'auto',
|
||||
fontFamily: FONT_OPTIONS.luckiest.value
|
||||
},
|
||||
image: {
|
||||
id: null,
|
||||
type: 'image',
|
||||
src: 'https://via.placeholder.com/600x300',
|
||||
alt: 'Image de description',
|
||||
bgColor: '#ffffff',
|
||||
padding: '0',
|
||||
align: 'center',
|
||||
width: '100%'
|
||||
},
|
||||
spacer: {
|
||||
id: null,
|
||||
type: 'spacer',
|
||||
height: '20',
|
||||
bgColor: '#ffffff'
|
||||
},
|
||||
footer: {
|
||||
id: null,
|
||||
type: 'footer',
|
||||
titleTop: 'Pour adhérer',
|
||||
btn1Text: 'CONTACTER TA SECTION',
|
||||
btn1Url: 'https://solidairesfinancespubliques.org/le-syndicat/adherer.html',
|
||||
btn1Color: '#800040',
|
||||
btn2Text: 'COTISER EN LIGNE',
|
||||
btn2Url: 'https://adherer.solidairesfinancespubliques.org/',
|
||||
btn2Color: '#22c55e',
|
||||
logoSrc: 'https://solidairesfinancespubliques.org/images/logo/pastille-122.png',
|
||||
slogan: 'Solidaires Finances Publiques est la première force syndicale de la DGFiP',
|
||||
address: 'Solidaires Finances Publiques\nBoite 24\n80 rue de Montreuil\n75011 PARIS\nTél. 01.89.16.48.49\nhttps://solidairesfinancespubliques.org\ncontact@solidairesfinancespubliques.org',
|
||||
legalText: 'Vous êtes destinataire de ce message d\'origine syndicale conformément aux dispositions de l\'article 8 de l\'arrêté du 4 novembre 2014 relatif aux conditions générales d\'utilisation par les organisations syndicales. Vous pouvez vous désabonner en répondant "Désabonnement".',
|
||||
bgColor: '#ffffff',
|
||||
fontFamily: FONT_OPTIONS.sans.value
|
||||
}
|
||||
};
|
||||
|
||||
export default function NewsletterBuilder() {
|
||||
const [blocks, setBlocks] = useState<Block[]>([
|
||||
{ ...BLOCK_TEMPLATES.header, id: 'init-1' },
|
||||
{ ...BLOCK_TEMPLATES.title, id: 'init-title' },
|
||||
{ ...BLOCK_TEMPLATES.text, id: 'init-2' },
|
||||
{ ...BLOCK_TEMPLATES.link, id: 'init-link' }
|
||||
]);
|
||||
const [selectedBlockId, setSelectedBlockId] = useState<string | null>(null);
|
||||
const [globalBg, setGlobalBg] = useState('#f3f4f6');
|
||||
const [isExporting, setIsExporting] = useState(false);
|
||||
|
||||
// --- LOGIQUE D'ÉDITION ---
|
||||
|
||||
const addBlock = (type: string) => {
|
||||
const template = BLOCK_TEMPLATES[type];
|
||||
const newBlock = JSON.parse(JSON.stringify(template));
|
||||
newBlock.id = `block-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
||||
setBlocks([...blocks, newBlock]);
|
||||
setSelectedBlockId(newBlock.id);
|
||||
};
|
||||
|
||||
const updateBlock = (id: string, field: string, value: any) => {
|
||||
setBlocks(blocks.map(b => {
|
||||
if (b.id !== id) return b;
|
||||
if (field.includes('.')) {
|
||||
const [parent, child] = field.split('.');
|
||||
return { ...b, [parent]: { ...b[parent], [child]: value } };
|
||||
}
|
||||
return { ...b, [field]: value };
|
||||
}));
|
||||
};
|
||||
|
||||
const deleteBlock = (id: string) => {
|
||||
setBlocks(blocks.filter(b => b.id !== id));
|
||||
if (selectedBlockId === id) setSelectedBlockId(null);
|
||||
};
|
||||
|
||||
const moveBlock = (index: number, direction: 'up' | 'down') => {
|
||||
if (direction === 'up' && index > 0) {
|
||||
const newBlocks = [...blocks];
|
||||
[newBlocks[index - 1], newBlocks[index]] = [newBlocks[index], newBlocks[index - 1]];
|
||||
setBlocks(newBlocks);
|
||||
}
|
||||
if (direction === 'down' && index < blocks.length - 1) {
|
||||
const newBlocks = [...blocks];
|
||||
[newBlocks[index + 1], newBlocks[index]] = [newBlocks[index], newBlocks[index + 1]];
|
||||
setBlocks(newBlocks);
|
||||
}
|
||||
};
|
||||
|
||||
const getSelectedBlock = () => blocks.find(b => b.id === selectedBlockId);
|
||||
|
||||
// --- MOTEUR D'EXPORT ---
|
||||
|
||||
const convertImageToBase64 = async (url: string) => {
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) throw new Error('Network response');
|
||||
const blob = await response.blob();
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.onloadend = () => resolve(reader.result as string);
|
||||
reader.onerror = reject;
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
} catch (error) {
|
||||
console.warn("CORS error image:", url);
|
||||
return url;
|
||||
}
|
||||
};
|
||||
|
||||
const createHeaderImage = async (block: any) => {
|
||||
// Si une image de fond est présente, on la charge d'abord
|
||||
let bgImageObj: HTMLImageElement | null = null;
|
||||
if (block.backgroundImage) {
|
||||
try {
|
||||
const base64Bg = await convertImageToBase64(block.backgroundImage);
|
||||
bgImageObj = new Image();
|
||||
bgImageObj.src = base64Bg;
|
||||
await new Promise((resolve) => {
|
||||
if (bgImageObj) bgImageObj.onload = resolve;
|
||||
else resolve(null);
|
||||
});
|
||||
} catch (e) {
|
||||
console.warn("Failed to load background image for header canvas", e);
|
||||
}
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
const canvas = document.createElement('canvas');
|
||||
const ctx = canvas.getContext('2d');
|
||||
if (!ctx) return;
|
||||
|
||||
const padding = parseInt(block.padding) || 0;
|
||||
const fontSize = parseInt(block.fontSize) || 24;
|
||||
const subFontSize = parseInt(block.subtitleFontSize) || 20;
|
||||
const lineHeightRatio = 1.1;
|
||||
const width = parseInt(DEFAULT_WIDTH);
|
||||
const gap = 10;
|
||||
|
||||
const lines = block.content.split('\n');
|
||||
const titleHeight = lines.length * (fontSize * lineHeightRatio);
|
||||
const subtitleHeight = block.subtitle ? (subFontSize * lineHeightRatio) + gap : 0;
|
||||
|
||||
const contentHeight = titleHeight + subtitleHeight;
|
||||
const canvasHeight = contentHeight + (padding * 2);
|
||||
|
||||
canvas.width = width;
|
||||
canvas.height = canvasHeight;
|
||||
|
||||
// 1. DESSINER LE FOND
|
||||
ctx.fillStyle = block.bgColor;
|
||||
ctx.fillRect(0, 0, width, canvasHeight);
|
||||
|
||||
// 2. DESSINER L'IMAGE DE FOND (Mode Cover)
|
||||
if (bgImageObj) {
|
||||
const imgRatio = bgImageObj.width / bgImageObj.height;
|
||||
const canvasRatio = width / canvasHeight;
|
||||
let drawWidth, drawHeight, offsetX, offsetY;
|
||||
|
||||
if (imgRatio > canvasRatio) {
|
||||
// Image plus large que le canvas (rogner côtés)
|
||||
drawHeight = canvasHeight;
|
||||
drawWidth = bgImageObj.width * (canvasHeight / bgImageObj.height);
|
||||
offsetX = (width - drawWidth) / 2;
|
||||
offsetY = 0;
|
||||
} else {
|
||||
// Image plus haute que le canvas (rogner haut/bas)
|
||||
drawWidth = width;
|
||||
drawHeight = bgImageObj.height * (width / bgImageObj.width);
|
||||
offsetX = 0;
|
||||
offsetY = (canvasHeight - drawHeight) / 2;
|
||||
}
|
||||
ctx.drawImage(bgImageObj, offsetX, offsetY, drawWidth, drawHeight);
|
||||
|
||||
// Optionnel : Ajouter un overlay semi-transparent pour la lisibilité
|
||||
// ctx.fillStyle = 'rgba(255, 255, 255, 0.7)';
|
||||
// ctx.fillRect(0, 0, width, canvasHeight);
|
||||
}
|
||||
|
||||
const cleanFontFamily = block.fontFamily.replace(/'/g, "").replace(/"/g, "");
|
||||
|
||||
let x = padding;
|
||||
if (block.align === 'center') {
|
||||
x = width / 2;
|
||||
ctx.textAlign = 'center';
|
||||
} else if (block.align === 'right') {
|
||||
x = width - padding;
|
||||
ctx.textAlign = 'right';
|
||||
} else {
|
||||
ctx.textAlign = 'left';
|
||||
}
|
||||
|
||||
// 3. DESSINER LE TEXTE
|
||||
ctx.font = `${fontSize}px ${cleanFontFamily}`;
|
||||
ctx.fillStyle = block.textColor;
|
||||
ctx.textBaseline = 'top';
|
||||
|
||||
lines.forEach((line: string, i: number) => {
|
||||
const y = padding + (i * fontSize * lineHeightRatio);
|
||||
ctx.fillText(line, x, y);
|
||||
});
|
||||
|
||||
if (block.subtitle) {
|
||||
ctx.font = `${subFontSize}px ${cleanFontFamily}`;
|
||||
ctx.fillStyle = block.subtitleColor || ORANGE_COLOR;
|
||||
const subY = padding + titleHeight + gap;
|
||||
ctx.fillText(block.subtitle, x, subY);
|
||||
}
|
||||
|
||||
// 4. DESSINER LA DÉCORATION
|
||||
if (block.decoration && block.decoration.enabled) {
|
||||
ctx.save();
|
||||
const decSize = parseInt(block.decoration.size) || 50;
|
||||
const decXOffset = parseInt(block.decoration.xOffset) || 0;
|
||||
const decYOffset = parseInt(block.decoration.yOffset) || 0;
|
||||
const decRotation = parseInt(block.decoration.rotation) || 0;
|
||||
|
||||
const decX = (width / 2) + decXOffset;
|
||||
const decY = (canvasHeight / 2) + decYOffset;
|
||||
|
||||
ctx.translate(decX, decY);
|
||||
ctx.rotate((decRotation * Math.PI) / 180);
|
||||
ctx.font = `${decSize}px ${cleanFontFamily}`;
|
||||
ctx.fillStyle = block.decoration.color;
|
||||
ctx.textAlign = 'center';
|
||||
ctx.textBaseline = 'middle';
|
||||
ctx.fillText(block.decoration.content, 0, 0);
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
resolve(canvas.toDataURL('image/png'));
|
||||
});
|
||||
};
|
||||
|
||||
const generateHTML = (blocksToRender: any[]) => {
|
||||
const renderBlockHTML = (block: any) => {
|
||||
const fontFamily = block.fontFamily || FONT_OPTIONS.sans.value;
|
||||
const commonStyle = `font-family: ${fontFamily}; box-sizing: border-box;`;
|
||||
|
||||
const borderRow = `<tr><td style="background-color: ${ORANGE_COLOR}; height: 1px; font-size: 0; line-height: 0;"> </td></tr>`;
|
||||
|
||||
switch (block.type) {
|
||||
case 'header':
|
||||
return `
|
||||
<tr><td align="${block.align}" style="background-color: ${block.bgColor}; padding: ${block.padding}px; background-image: url('${block.backgroundImage}'); background-size: cover; background-position: center;">
|
||||
<h1 style="margin: 0; color: ${block.textColor}; font-size: ${block.fontSize}px; ${commonStyle} line-height: 1.1;">${block.content.replace(/\n/g, '<br>')}</h1>
|
||||
${block.subtitle ? `<div style="color: ${block.subtitleColor || ORANGE_COLOR}; font-size: ${block.subtitleFontSize || 20}px; margin-top: 10px; ${commonStyle}">${block.subtitle}</div>` : ''}
|
||||
</td></tr>
|
||||
${borderRow}`;
|
||||
|
||||
case 'title':
|
||||
return `
|
||||
<tr><td align="${block.align}" style="background-color: ${block.bgColor}; padding: ${block.padding}px;">
|
||||
<h2 style="margin: 0; color: ${block.textColor}; font-size: ${block.fontSize}px; ${commonStyle} font-weight: bold; text-transform: uppercase; line-height: 1.2;">${block.content.replace(/\n/g, '<br>')}</h2>
|
||||
</td></tr>`;
|
||||
|
||||
case 'divider':
|
||||
return `
|
||||
<tr>
|
||||
<td style="background-color: ${block.bgColor}; padding: ${block.padding}px;">
|
||||
<div style="border-top: ${block.thickness}px ${block.lineStyle} ${block.lineColor}; width: 100%; height: 1px;"></div>
|
||||
</td>
|
||||
</tr>`;
|
||||
|
||||
case 'text':
|
||||
return `
|
||||
<tr>
|
||||
<td align="${block.align}" style="background-color: ${block.bgColor}; padding: ${block.padding}px; color: ${block.textColor}; font-size: ${block.fontSize}px; line-height: ${block.lineHeight}; ${commonStyle}">
|
||||
${block.content.replace(/\n/g, '<br>')}
|
||||
</td>
|
||||
</tr>`;
|
||||
|
||||
case 'link':
|
||||
return `
|
||||
<tr>
|
||||
<td align="${block.align}" style="background-color: ${block.bgColor}; padding: ${block.padding}px;">
|
||||
<a href="${block.url}" target="_blank" style="color: ${block.textColor}; font-size: ${block.fontSize}px; ${commonStyle} text-decoration: underline;">
|
||||
${block.content}
|
||||
</a>
|
||||
</td>
|
||||
</tr>`;
|
||||
|
||||
case 'button':
|
||||
const btnDisplay = block.width === 'full' ? 'block' : 'inline-block';
|
||||
return `
|
||||
<tr>
|
||||
<td align="${block.align}" style="background-color: ${block.bgColor}; padding: ${block.padding}px;">
|
||||
<table border="0" cellspacing="0" cellpadding="0"><tr><td align="center" style="border-radius: ${block.borderRadius}px;" bgcolor="${block.btnColor}">
|
||||
<a href="${block.url}" target="_blank" style="font-size: 16px; font-family: ${fontFamily}; color: ${block.textColor}; text-decoration: none; border-radius: ${block.borderRadius}px; padding: 12px 24px; border: 1px solid ${block.btnColor}; display: ${btnDisplay}; font-weight: bold;">${block.content}</a>
|
||||
</td></tr></table>
|
||||
</td>
|
||||
</tr>`;
|
||||
|
||||
case 'image':
|
||||
const imgHtml = `<tr><td align="${block.align}" style="background-color: ${block.bgColor}; padding: ${block.padding}px;"><img src="${block.src}" alt="${block.alt}" width="${block.width === '100%' ? '600' : block.width}" style="display: block; border: 0; max-width: 100%; width: ${block.width}; height: auto;" /></td></tr>`;
|
||||
return block.isHeaderResult ? imgHtml + borderRow : imgHtml;
|
||||
|
||||
case 'spacer':
|
||||
return `<tr><td style="background-color: ${block.bgColor}; height: ${block.height}px; font-size: 0; line-height: 0;"> </td></tr>`;
|
||||
|
||||
case 'footer':
|
||||
return `
|
||||
<tr><td align="center" style="background-color: #ffffff; padding: 20px 10px 5px 10px; ${commonStyle}"><strong style="font-style: italic; font-size: 14px;">${block.titleTop}</strong></td></tr>
|
||||
<tr><td align="center" style="padding: 10px 20px 20px 20px; background-color: #ffffff;">
|
||||
<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr>
|
||||
<td align="center" width="50%" style="padding-right: 5px;"><table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td align="center" bgcolor="${block.btn1Color}" style="border-radius: 4px;"><a href="${block.btn1Url}" target="_blank" style="font-size: 12px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 10px 5px; display: block; font-weight: bold; text-transform: uppercase;">${block.btn1Text}</a></td></tr></table></td>
|
||||
<td align="center" width="50%" style="padding-left: 5px;"><table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td align="center" bgcolor="${block.btn2Color}" style="border-radius: 4px;"><a href="${block.btn2Url}" target="_blank" style="font-size: 12px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; padding: 10px 5px; display: block; font-weight: bold; text-transform: uppercase;">${block.btn2Text}</a></td></tr></table></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
<tr><td style="padding: 0 10px;"><div style="border-bottom: 1px dotted ${ORANGE_COLOR}; height: 1px; width: 100%;"></div></td></tr>
|
||||
<tr><td align="center" style="background-color: #ffffff; padding: 20px; ${commonStyle}">
|
||||
<img src="${block.logoSrc}" alt="Logo" width="80" height="80" style="display: block; border: 0; border-radius: 50%; margin-bottom: 10px;" />
|
||||
<div style="font-style: italic; font-size: 14px; margin-bottom: 15px; font-weight: bold;">${block.slogan}</div>
|
||||
<div style="font-size: 14px; line-height: 1.4; color: #333;">${block.address.replace(/\n/g, '<br>')}</div>
|
||||
</td></tr>
|
||||
<tr><td style="padding: 0 10px 10px 10px;"><div style="border-bottom: 3px solid ${ORANGE_COLOR}; height: 3px; width: 100%;"></div></td></tr>
|
||||
<tr><td align="justify" style="background-color: #f9f9f9; padding: 15px; color: #666666; font-size: 10px; ${commonStyle} line-height: 1.3; text-align: justify;">${block.legalText}</td></tr>
|
||||
`;
|
||||
default: return '';
|
||||
}
|
||||
};
|
||||
|
||||
const rows = blocksToRender.map(renderBlockHTML).join('');
|
||||
|
||||
return `<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Newsletter</title>
|
||||
<style>body { margin: 0; padding: 0; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } img { border: 0; height: auto; line-height: 100%; outline: none; text-decoration: none; } table { border-collapse: collapse !important; } body { height: 100% !important; margin: 0 !important; padding: 0 !important; width: 100% !important; }</style>
|
||||
</head>
|
||||
<body style="margin: 0; padding: 0; background-color: ${globalBg};">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="center" bgcolor="${globalBg}" style="padding: 20px 0;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: ${DEFAULT_WIDTH}px; min-width: 320px; background-color: #ffffff;">
|
||||
${rows}
|
||||
</table>
|
||||
</td></tr></table>
|
||||
</body></html>`;
|
||||
};
|
||||
|
||||
const downloadHTML = async () => {
|
||||
setIsExporting(true);
|
||||
await document.fonts.ready;
|
||||
const processedBlocks = await Promise.all(blocks.map(async (block) => {
|
||||
if (block.type === 'image') {
|
||||
const base64Src = await convertImageToBase64(block.src);
|
||||
return { ...block, src: base64Src };
|
||||
} else if (block.type === 'footer') {
|
||||
const base64Logo = await convertImageToBase64(block.logoSrc);
|
||||
return { ...block, logoSrc: base64Logo };
|
||||
} else if (block.type === 'header') {
|
||||
// Cette fonction gère maintenant l'image de fond et la dessine dans le canvas
|
||||
const base64Header = await createHeaderImage(block);
|
||||
return { type: 'image', src: base64Header, alt: block.content.replace(/\n/g, ' '), width: '100%', align: 'center', padding: 0, bgColor: block.bgColor, isHeaderResult: true };
|
||||
}
|
||||
return block;
|
||||
}));
|
||||
const html = generateHTML(processedBlocks);
|
||||
const blob = new Blob([html], { type: 'text/html' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = 'newsletter-export.html';
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
setIsExporting(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex h-screen w-full bg-gray-100 text-sm text-slate-800 font-sans overflow-hidden">
|
||||
<style>{`@import url('https://fonts.googleapis.com/css2?family=Luckiest+Guy&family=Open+Sans:wght@400;700&family=Roboto:wght@400;700&display=swap');`}</style>
|
||||
|
||||
{/* GAUCHE: ÉDITEUR */}
|
||||
<div className="w-96 flex flex-col bg-white border-r border-gray-200 shadow-lg z-10">
|
||||
<div className="p-4 border-b border-gray-200 bg-slate-50">
|
||||
<h1 className="font-bold text-lg text-slate-800 flex items-center gap-2">
|
||||
<Layout className="w-5 h-5 text-indigo-600" /> Builder Email
|
||||
</h1>
|
||||
<p className="text-xs text-slate-500 mt-1">Version Bulletin Mensuel</p>
|
||||
</div>
|
||||
|
||||
<div className="p-4 border-b border-gray-200">
|
||||
<h2 className="text-xs font-semibold text-slate-500 uppercase tracking-wider mb-3">Ajouter un bloc</h2>
|
||||
<div className="grid grid-cols-3 gap-2">
|
||||
<BlockButton icon={<Layout size={16} />} label="En-tête" onClick={() => addBlock('header')} />
|
||||
<BlockButton icon={<Minus size={16} />} label="Séparateur" onClick={() => addBlock('divider')} />
|
||||
<BlockButton icon={<Heading size={16} />} label="Titre" onClick={() => addBlock('title')} />
|
||||
<BlockButton icon={<Type size={16} />} label="Texte" onClick={() => addBlock('text')} />
|
||||
<BlockButton icon={<LinkIcon size={16} />} label="Lien Texte" onClick={() => addBlock('link')} />
|
||||
<BlockButton icon={<MousePointer2 size={16} />} label="Bouton" onClick={() => addBlock('button')} />
|
||||
<BlockButton icon={<ImageIcon size={16} />} label="Image" onClick={() => addBlock('image')} />
|
||||
<BlockButton icon={<AlignRight size={16} />} label="Espace" onClick={() => addBlock('spacer')} />
|
||||
<BlockButton icon={<Code size={16} />} label="Pied" onClick={() => addBlock('footer')} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex-1 overflow-y-auto p-4 custom-scrollbar">
|
||||
{selectedBlockId ? (
|
||||
<EditPanel block={getSelectedBlock()} updateBlock={updateBlock} deleteBlock={deleteBlock} />
|
||||
) : (
|
||||
<div className="h-full flex flex-col items-center justify-center text-slate-400 text-center px-4">
|
||||
<MousePointer2 size={48} className="mb-4 opacity-20" />
|
||||
<p>Sélectionnez un bloc.</p>
|
||||
{/* Configuration Global BG */}
|
||||
<div className="mt-8 w-full">
|
||||
<label className="block text-xs font-semibold text-left mb-2 text-slate-500">Couleur de fond globale</label>
|
||||
<div className="flex items-center gap-2 bg-slate-50 p-2 rounded border">
|
||||
<input
|
||||
type="color"
|
||||
value={globalBg}
|
||||
onChange={(e) => setGlobalBg(e.target.value)}
|
||||
className="w-6 h-6 rounded cursor-pointer border-none"
|
||||
/>
|
||||
<span className="text-xs font-mono">{globalBg}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="p-4 border-t border-gray-200 bg-slate-50">
|
||||
<button onClick={downloadHTML} disabled={isExporting} className={`w-full flex items-center justify-center gap-2 py-3 px-4 rounded-md font-medium transition-colors shadow-sm ${isExporting ? 'bg-indigo-400 cursor-wait' : 'bg-indigo-600 hover:bg-indigo-700'} text-white`}>
|
||||
{isExporting ? <><Loader2 className="animate-spin" size={18} /> Traitement...</> : <><Download size={18} /> Exporter HTML</>}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* DROITE: VISUALISATION */}
|
||||
<div className="flex-1 bg-gray-200 overflow-y-auto flex justify-center p-8 relative">
|
||||
<div className="w-full h-min min-h-[600px] transition-colors duration-300" style={{ backgroundColor: globalBg }}>
|
||||
<div className="py-10 flex justify-center">
|
||||
<div className="bg-white shadow-2xl" style={{ width: `${DEFAULT_WIDTH}px`, minHeight: '400px' }}>
|
||||
{blocks.map((block, index) => (
|
||||
<div key={block.id} onClick={() => setSelectedBlockId(block.id)} className={`relative group cursor-pointer hover:outline hover:outline-2 hover:outline-blue-300 hover:z-10 ${selectedBlockId === block.id ? 'outline outline-2 outline-indigo-600 z-20' : ''}`}>
|
||||
{selectedBlockId === block.id && (
|
||||
<div className="absolute -right-10 top-0 flex flex-col gap-1">
|
||||
<button onClick={(e) => { e.stopPropagation(); moveBlock(index, 'up'); }} className="p-1 bg-white border border-gray-300 rounded shadow hover:bg-gray-50 text-gray-600"><svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M5 15l7-7 7 7"></path></svg></button>
|
||||
<button onClick={(e) => { e.stopPropagation(); moveBlock(index, 'down'); }} className="p-1 bg-white border border-gray-300 rounded shadow hover:bg-gray-50 text-gray-600"><svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M19 9l-7 7-7-7"></path></svg></button>
|
||||
<button onClick={(e) => { e.stopPropagation(); deleteBlock(block.id); }} className="p-1 bg-red-50 border border-red-200 rounded shadow hover:bg-red-100 text-red-600"><Trash2 size={16} /></button>
|
||||
</div>
|
||||
)}
|
||||
<PreviewBlock block={block} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function BlockButton({ icon, label, onClick }: { icon: any, label: string, onClick: () => void }) {
|
||||
return (
|
||||
<button onClick={onClick} className="flex flex-col items-center justify-center p-3 bg-white border border-gray-200 rounded hover:bg-indigo-50 hover:border-indigo-200 hover:text-indigo-600 transition-all gap-2 shadow-sm">
|
||||
{icon}
|
||||
<span className="text-xs font-medium text-center">{label}</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
function EditPanel({ block, updateBlock, deleteBlock }: { block: any, updateBlock: (id: string, field: string, value: any) => void, deleteBlock: (id: string) => void }) {
|
||||
if (!block) return null;
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="flex justify-between items-center border-b pb-2">
|
||||
<h3 className="font-bold text-slate-700 capitalize">{block.type}</h3>
|
||||
<button onClick={() => deleteBlock(block.id)} className="text-xs text-red-500 hover:text-red-700 flex items-center gap-1"><Trash2 size={12} /> Supprimer</button>
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
{/* ÉDITION CONTENU (HEADER, TEXTE, LINK, BUTTON, TITLE) */}
|
||||
{(['header', 'text', 'button', 'link', 'title'].includes(block.type)) && (
|
||||
<>
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-slate-500 mb-1">Contenu</label>
|
||||
<textarea
|
||||
rows={block.type === 'header' ? 3 : 6}
|
||||
className="w-full p-2 border border-gray-300 rounded text-sm"
|
||||
value={block.content}
|
||||
onChange={(e) => updateBlock(block.id, 'content', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* SOUS-TITRE POUR HEADER */}
|
||||
{block.type === 'header' && (
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-slate-500 mb-1">Sous-titre</label>
|
||||
<input type="text" value={block.subtitle || ''} onChange={(e) => updateBlock(block.id, 'subtitle', e.target.value)} className="w-full p-2 border border-gray-300 rounded text-sm" />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-slate-500 mb-1">Typographie</label>
|
||||
<select value={block.fontFamily || FONT_OPTIONS.sans.value} onChange={(e) => updateBlock(block.id, 'fontFamily', e.target.value)} className="w-full p-2 border border-gray-300 rounded text-sm">
|
||||
{Object.values(FONT_OPTIONS).map(font => (
|
||||
<option key={font.value} value={font.value}>{font.label}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* ÉDITION SPÉCIFIQUE HEADER : IMAGE DE FOND */}
|
||||
{block.type === 'header' && (
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-slate-500 mb-1">Image de fond (URL)</label>
|
||||
<input
|
||||
type="text"
|
||||
value={block.backgroundImage || ''}
|
||||
onChange={(e) => updateBlock(block.id, 'backgroundImage', e.target.value)}
|
||||
className="w-full p-2 border border-gray-300 rounded text-sm"
|
||||
placeholder="https://..."
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ÉDITION SPÉCIFIQUE DIVIDER */}
|
||||
{block.type === 'divider' && (
|
||||
<>
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-slate-500 mb-1">Style de ligne</label>
|
||||
<select value={block.lineStyle} onChange={(e) => updateBlock(block.id, 'lineStyle', e.target.value)} className="w-full p-2 border border-gray-300 rounded text-sm">
|
||||
<option value="solid">Pleine (Solid)</option>
|
||||
<option value="dotted">Pointillée (Dotted)</option>
|
||||
<option value="dashed">Tirets (Dashed)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-slate-500 mb-1">Épaisseur (px)</label>
|
||||
<input type="number" value={block.thickness} onChange={(e) => updateBlock(block.id, 'thickness', e.target.value)} className="w-full p-2 border border-gray-300 rounded text-sm" />
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-slate-500 mb-1">Couleur Ligne</label>
|
||||
<div className="flex items-center gap-2"><input type="color" value={block.lineColor} onChange={(e) => updateBlock(block.id, 'lineColor', e.target.value)} className="h-8 w-8 rounded border-0 cursor-pointer" /></div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* DÉCORATION HEADER */}
|
||||
{block.type === 'header' && (
|
||||
<div className="bg-orange-50 p-3 rounded border border-orange-100">
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<label className="block text-xs font-bold text-orange-700 flex items-center gap-1"><Smile size={12}/> Décoration</label>
|
||||
<input type="checkbox" checked={block.decoration?.enabled || false} onChange={(e) => updateBlock(block.id, 'decoration.enabled', e.target.checked)} className="cursor-pointer"/>
|
||||
</div>
|
||||
{block.decoration?.enabled && (
|
||||
<div className="space-y-2">
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<input type="text" value={block.decoration.content} onChange={(e) => updateBlock(block.id, 'decoration.content', e.target.value)} className="w-full p-1 border rounded text-sm text-center" maxLength={2} />
|
||||
<input type="color" value={block.decoration.color} onChange={(e) => updateBlock(block.id, 'decoration.color', e.target.value)} className="w-full h-7 p-0 border rounded cursor-pointer" />
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<input type="number" value={block.decoration.size} onChange={(e) => updateBlock(block.id, 'decoration.size', e.target.value)} className="w-full p-1 border rounded text-xs" placeholder="Taille"/>
|
||||
<input type="number" value={block.decoration.rotation} onChange={(e) => updateBlock(block.id, 'decoration.rotation', e.target.value)} className="w-full p-1 border rounded text-xs" placeholder="Rot °"/>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<input type="number" value={block.decoration.xOffset} onChange={(e) => updateBlock(block.id, 'decoration.xOffset', e.target.value)} className="w-full p-1 border rounded text-xs" placeholder="X"/>
|
||||
<input type="number" value={block.decoration.yOffset} onChange={(e) => updateBlock(block.id, 'decoration.yOffset', e.target.value)} className="w-full p-1 border rounded text-xs" placeholder="Y"/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* FOOTER SPÉCIFIQUE */}
|
||||
{block.type === 'footer' && (
|
||||
<div className="space-y-3">
|
||||
<input type="text" value={block.titleTop} onChange={(e) => updateBlock(block.id, 'titleTop', e.target.value)} className="w-full p-1 border mb-2 text-xs" />
|
||||
<div className="grid grid-cols-2 gap-1 mb-2">
|
||||
<input type="text" value={block.btn1Text} onChange={(e) => updateBlock(block.id, 'btn1Text', e.target.value)} className="w-full p-1 border text-xs" />
|
||||
<input type="color" value={block.btn1Color} onChange={(e) => updateBlock(block.id, 'btn1Color', e.target.value)} className="w-full h-6 p-0" />
|
||||
</div>
|
||||
<input type="text" value={block.btn1Url} onChange={(e) => updateBlock(block.id, 'btn1Url', e.target.value)} className="w-full p-1 border mb-2 text-xs" />
|
||||
<div className="grid grid-cols-2 gap-1 mb-2">
|
||||
<input type="text" value={block.btn2Text} onChange={(e) => updateBlock(block.id, 'btn2Text', e.target.value)} className="w-full p-1 border text-xs" />
|
||||
<input type="color" value={block.btn2Color} onChange={(e) => updateBlock(block.id, 'btn2Color', e.target.value)} className="w-full h-6 p-0" />
|
||||
</div>
|
||||
<input type="text" value={block.btn2Url} onChange={(e) => updateBlock(block.id, 'btn2Url', e.target.value)} className="w-full p-1 border text-xs" />
|
||||
<input type="text" value={block.logoSrc} onChange={(e) => updateBlock(block.id, 'logoSrc', e.target.value)} className="w-full p-2 border border-gray-300 rounded text-sm mt-2" placeholder="Logo URL" />
|
||||
<input type="text" value={block.slogan} onChange={(e) => updateBlock(block.id, 'slogan', e.target.value)} className="w-full p-2 border border-gray-300 rounded text-sm font-bold mt-2" />
|
||||
<textarea rows={4} className="w-full p-2 border border-gray-300 rounded text-sm mt-2" value={block.address} onChange={(e) => updateBlock(block.id, 'address', e.target.value)} />
|
||||
<textarea rows={4} className="w-full p-2 border border-gray-300 rounded text-xs text-gray-500 mt-2" value={block.legalText} onChange={(e) => updateBlock(block.id, 'legalText', e.target.value)} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* URL COMMUNE */}
|
||||
{(block.type === 'image' || block.type === 'button' || block.type === 'link') && (
|
||||
<div><label className="block text-xs font-semibold text-slate-500 mb-1">Lien / Src</label><input type="text" value={block.url || block.src} onChange={(e) => updateBlock(block.id, block.type === 'image' ? 'src' : 'url', e.target.value)} className="w-full p-2 border border-gray-300 rounded text-sm" /></div>
|
||||
)}
|
||||
|
||||
{/* ALIGNEMENT */}
|
||||
{block.type !== 'spacer' && block.type !== 'footer' && block.type !== 'divider' && (
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-slate-500 mb-1">Alignement</label>
|
||||
<div className="flex border border-gray-300 rounded overflow-hidden">
|
||||
{['left', 'center', 'right'].map(align => (
|
||||
<button key={align} onClick={() => updateBlock(block.id, 'align', align)} className={`flex-1 p-2 flex justify-center ${block.align === align ? 'bg-indigo-100 text-indigo-600' : 'bg-white hover:bg-gray-50'}`}>
|
||||
{align === 'left' && <AlignLeft size={16} />}{align === 'center' && <AlignCenter size={16} />}{align === 'right' && <AlignRight size={16} />}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* COULEURS COMMUNES */}
|
||||
{block.type !== 'footer' && block.type !== 'divider' && (
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div><label className="block text-xs font-semibold text-slate-500 mb-1">Fond</label><div className="flex items-center gap-2"><input type="color" value={block.bgColor} onChange={(e) => updateBlock(block.id, 'bgColor', e.target.value)} className="h-8 w-8 rounded border-0 cursor-pointer" /></div></div>
|
||||
{block.textColor && (<div><label className="block text-xs font-semibold text-slate-500 mb-1">Texte</label><div className="flex items-center gap-2"><input type="color" value={block.textColor} onChange={(e) => updateBlock(block.id, 'textColor', e.target.value)} className="h-8 w-8 rounded border-0 cursor-pointer" /></div></div>)}
|
||||
{block.type === 'button' && (<div><label className="block text-xs font-semibold text-slate-500 mb-1">Bouton</label><div className="flex items-center gap-2"><input type="color" value={block.btnColor} onChange={(e) => updateBlock(block.id, 'btnColor', e.target.value)} className="h-8 w-8 rounded border-0 cursor-pointer" /></div></div>)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* DIMENSIONS COMMUNES */}
|
||||
{block.type !== 'footer' && (
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
{block.padding !== undefined && (<div><label className="block text-xs font-semibold text-slate-500 mb-1">Padding</label><input type="number" value={block.padding} onChange={(e) => updateBlock(block.id, 'padding', e.target.value)} className="w-full p-2 border border-gray-300 rounded text-sm" /></div>)}
|
||||
{block.fontSize !== undefined && (<div><label className="block text-xs font-semibold text-slate-500 mb-1">Police (px)</label><input type="number" value={block.fontSize} onChange={(e) => updateBlock(block.id, 'fontSize', e.target.value)} className="w-full p-2 border border-gray-300 rounded text-sm" /></div>)}
|
||||
{block.type === 'spacer' && (<div><label className="block text-xs font-semibold text-slate-500 mb-1">Hauteur</label><input type="number" value={block.height} onChange={(e) => updateBlock(block.id, 'height', e.target.value)} className="w-full p-2 border border-gray-300 rounded text-sm" /></div>)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function PreviewBlock({ block }: { block: any }) {
|
||||
const fontFamily = block.fontFamily || FONT_OPTIONS.sans.value;
|
||||
const containerStyle: React.CSSProperties = { backgroundColor: block.bgColor, padding: `${block.padding}px`, textAlign: block.align as any };
|
||||
const textStyle: React.CSSProperties = { color: block.textColor, fontSize: `${block.fontSize}px`, lineHeight: block.lineHeight || '1.2', fontFamily: fontFamily, margin: 0, whiteSpace: 'pre-wrap' };
|
||||
|
||||
switch (block.type) {
|
||||
case 'header':
|
||||
return (
|
||||
<>
|
||||
<div style={{
|
||||
...containerStyle,
|
||||
position: 'relative',
|
||||
overflow: 'hidden',
|
||||
backgroundImage: block.backgroundImage ? `url(${block.backgroundImage})` : 'none',
|
||||
backgroundSize: 'cover',
|
||||
backgroundPosition: 'center',
|
||||
}}>
|
||||
<h1 style={{...textStyle, fontWeight: 'normal', lineHeight: '1.1', position: 'relative', zIndex: 1}}>{block.content}</h1>
|
||||
{block.subtitle && (
|
||||
<div style={{
|
||||
color: block.subtitleColor || ORANGE_COLOR,
|
||||
fontSize: `${block.subtitleFontSize || 24}px`,
|
||||
marginTop: '10px',
|
||||
fontFamily: fontFamily,
|
||||
position: 'relative',
|
||||
zIndex: 1
|
||||
}}>
|
||||
{block.subtitle}
|
||||
</div>
|
||||
)}
|
||||
{block.decoration?.enabled && (
|
||||
<div style={{ position: 'absolute', top: '50%', left: '50%', transform: `translate(-50%, -50%) translate(${block.decoration.xOffset}px, ${block.decoration.yOffset}px) rotate(${block.decoration.rotation}deg)`, color: block.decoration.color, fontSize: `${block.decoration.size}px`, fontFamily: fontFamily, pointerEvents: 'none', zIndex: 0, lineHeight: 1 }}>{block.decoration.content}</div>
|
||||
)}
|
||||
</div>
|
||||
{/* RESTAURATION DE LA LIGNE ORANGE */}
|
||||
<div style={{ backgroundColor: ORANGE_COLOR, height: '1px', width: '100%' }}></div>
|
||||
</>
|
||||
);
|
||||
|
||||
case 'title':
|
||||
return (
|
||||
<div style={containerStyle}>
|
||||
<h2 style={{
|
||||
...textStyle,
|
||||
fontWeight: 'bold',
|
||||
textTransform: 'uppercase',
|
||||
margin: 0
|
||||
}}>
|
||||
{block.content}
|
||||
</h2>
|
||||
</div>
|
||||
);
|
||||
|
||||
case 'divider':
|
||||
return (
|
||||
<div style={{ backgroundColor: block.bgColor, padding: `${block.padding}px` }}>
|
||||
<div style={{ borderTop: `${block.thickness}px ${block.lineStyle} ${block.lineColor}`, width: '100%' }}></div>
|
||||
</div>
|
||||
);
|
||||
case 'text':
|
||||
return <div style={containerStyle}><div style={textStyle}>{block.content}</div></div>;
|
||||
case 'link':
|
||||
return (
|
||||
<div style={containerStyle}>
|
||||
<a href={block.url} onClick={(e) => e.preventDefault()} style={{...textStyle, textDecoration: 'underline', display: 'inline-block' }}>{block.content}</a>
|
||||
</div>
|
||||
);
|
||||
case 'footer':
|
||||
return (
|
||||
<div style={{ backgroundColor: '#fff', fontFamily: 'Helvetica, Arial, sans-serif' }}>
|
||||
<div style={{ padding: '20px 10px 5px 10px', textAlign: 'center' }}>
|
||||
<div style={{ fontStyle: 'italic', fontWeight: 'bold', marginBottom: '10px' }}>{block.titleTop}</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'center', gap: '10px' }}>
|
||||
<a href="#" onClick={e => e.preventDefault()} style={{ flex: 1, backgroundColor: block.btn1Color, color: 'white', padding: '10px', textDecoration: 'none', borderRadius: '4px', fontWeight: 'bold', fontSize: '11px', textTransform: 'uppercase', textAlign: 'center' }}>{block.btn1Text}</a>
|
||||
<a href="#" onClick={e => e.preventDefault()} style={{ flex: 1, backgroundColor: block.btn2Color, color: 'white', padding: '10px', textDecoration: 'none', borderRadius: '4px', fontWeight: 'bold', fontSize: '11px', textTransform: 'uppercase', textAlign: 'center' }}>{block.btn2Text}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ padding: '0 10px' }}><div style={{ borderBottom: `1px dotted ${ORANGE_COLOR}`, width: '100%', height: '1px' }}></div></div>
|
||||
<div style={{ padding: '20px', textAlign: 'center' }}>
|
||||
<img src={block.logoSrc} alt="logo" style={{ width: '80px', height: '80px', borderRadius: '50%', margin: '0 auto 10px auto', display: 'block', objectFit: 'cover' }} />
|
||||
<div style={{ fontWeight: 'bold', fontStyle: 'italic', fontSize: '14px', marginBottom: '10px' }}>{block.slogan}</div>
|
||||
<div style={{ whiteSpace: 'pre-wrap', fontSize: '14px', lineHeight: '1.4' }}>{block.address}</div>
|
||||
</div>
|
||||
<div style={{ padding: '0 10px 10px 10px' }}><div style={{ borderBottom: `3px solid ${ORANGE_COLOR}`, width: '100%', height: '3px' }}></div></div>
|
||||
<div style={{ backgroundColor: '#f9f9f9', padding: '15px', fontSize: '10px', color: '#666', lineHeight: '1.3', textAlign: 'justify' }}>{block.legalText}</div>
|
||||
</div>
|
||||
);
|
||||
case 'image':
|
||||
return <div style={containerStyle}><img src={block.src} alt={block.alt} style={{ maxWidth: '100%', width: block.width === '100%' ? '100%' : block.width, height: 'auto', display: 'inline-block' }} /></div>;
|
||||
case 'button':
|
||||
return (
|
||||
<div style={containerStyle}>
|
||||
<a href={block.url} onClick={(e) => e.preventDefault()} style={{ display: block.width === 'full' ? 'block' : 'inline-block', backgroundColor: block.btnColor, color: block.textColor, padding: '12px 24px', textDecoration: 'none', borderRadius: `${block.borderRadius}px`, fontWeight: 'bold', fontFamily: fontFamily, border: `1px solid ${block.btnColor}` }}>{block.content}</a>
|
||||
</div>
|
||||
);
|
||||
case 'spacer':
|
||||
return <div style={{ backgroundColor: block.bgColor, height: `${block.height}px` }}></div>;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
1
src/assets/react.svg
Normal file
1
src/assets/react.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 4.0 KiB |
1
src/index.css
Normal file
1
src/index.css
Normal file
@@ -0,0 +1 @@
|
||||
@import "tailwindcss";
|
||||
10
src/main.tsx
Normal file
10
src/main.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { StrictMode } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import './index.css'
|
||||
import App from './App.tsx'
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
</StrictMode>,
|
||||
)
|
||||
10
tailwind.config.js
Normal file
10
tailwind.config.js
Normal file
@@ -0,0 +1,10 @@
|
||||
export default {
|
||||
content: [
|
||||
"./index.html",
|
||||
"./src/**/*.{js,ts,jsx,tsx}",
|
||||
],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||
28
tsconfig.app.json
Normal file
28
tsconfig.app.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
"target": "ES2022",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"types": ["vite/client"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
7
tsconfig.json
Normal file
7
tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.app.json" },
|
||||
{ "path": "./tsconfig.node.json" }
|
||||
]
|
||||
}
|
||||
26
tsconfig.node.json
Normal file
26
tsconfig.node.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||
"target": "ES2023",
|
||||
"lib": ["ES2023"],
|
||||
"module": "ESNext",
|
||||
"types": ["node"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
7
vite.config.ts
Normal file
7
vite.config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
})
|
||||
Reference in New Issue
Block a user