Enhance form styling and add Markdown help toggle in recipe creation and editing pages. Enhance form and styling on other pages aswell.

This commit is contained in:
Nils-Johan Gynther
2026-04-10 19:56:49 +02:00
parent 34d10eb93f
commit bc2480b3cb
7 changed files with 350 additions and 76 deletions
+39 -5
View File
@@ -57,6 +57,7 @@ export default function EditRecipePage() {
const [isDeleting, setIsDeleting] = useState(false);
const [error, setError] = useState<string | null>(null);
const [showPreview, setShowPreview] = useState(false);
const [showMarkdownHelp, setShowMarkdownHelp] = useState(false);
useEffect(() => {
const loadData = async () => {
@@ -205,6 +206,7 @@ export default function EditRecipePage() {
borderRadius: '4px',
fontSize: '1rem',
minHeight: '44px',
boxSizing: 'border-box',
}}
/>
</div>
@@ -225,6 +227,7 @@ export default function EditRecipePage() {
fontSize: '1rem',
minHeight: '100px',
fontFamily: 'inherit',
boxSizing: 'border-box',
}}
/>
</div>
@@ -233,10 +236,32 @@ export default function EditRecipePage() {
<label style={{ display: 'block', marginBottom: '0.5rem', fontWeight: 600 }}>
Instruktioner
</label>
<div style={{ marginBottom: '0.5rem', fontSize: '0.85rem', background: '#f9f9f9', padding: '0.5rem', borderRadius: '4px', color: '#666' }}>
<strong>Markdown-stöd:</strong>
<div style={{ whiteSpace: 'pre-wrap', marginTop: '0.25rem' }}>{MARKDOWN_HELP}</div>
</div>
<button
type="button"
onClick={() => setShowMarkdownHelp(!showMarkdownHelp)}
style={{
marginBottom: '0.5rem',
padding: '0.4rem 0.75rem',
background: '#f9f9f9',
border: '1px solid #ddd',
borderRadius: '4px',
cursor: 'pointer',
fontSize: '0.85rem',
color: '#666',
fontWeight: 500,
display: 'flex',
alignItems: 'center',
gap: '0.25rem',
}}
>
<span>{showMarkdownHelp ? '▼' : '▶'}</span>
<strong>Markdown-stöd</strong>
</button>
{showMarkdownHelp && (
<div style={{ marginBottom: '0.5rem', fontSize: '0.85rem', background: '#f9f9f9', padding: '0.5rem', borderRadius: '4px', color: '#666' }}>
<div style={{ whiteSpace: 'pre-wrap', marginTop: '0.25rem' }}>{MARKDOWN_HELP}</div>
</div>
)}
<textarea
value={recipe.instructions}
@@ -249,7 +274,8 @@ export default function EditRecipePage() {
borderRadius: '4px',
fontSize: '1rem',
minHeight: '150px',
fontFamily: 'monospace',
fontFamily: 'inherit',
boxSizing: 'border-box',
}}
/>
@@ -313,6 +339,8 @@ export default function EditRecipePage() {
borderRadius: '4px',
fontSize: '1rem',
minHeight: '44px',
boxSizing: 'border-box',
width: '100%',
}}
>
<option value={0}>Välj produkt</option>
@@ -335,6 +363,8 @@ export default function EditRecipePage() {
borderRadius: '4px',
fontSize: '1rem',
minHeight: '44px',
boxSizing: 'border-box',
width: '100%',
}}
/>
@@ -348,6 +378,8 @@ export default function EditRecipePage() {
borderRadius: '4px',
fontSize: '1rem',
minHeight: '44px',
boxSizing: 'border-box',
width: '100%',
}}
>
{UNIT_OPTIONS.map((opt) => (
@@ -368,6 +400,8 @@ export default function EditRecipePage() {
borderRadius: '4px',
fontSize: '1rem',
minHeight: '44px',
boxSizing: 'border-box',
width: '100%',
}}
/>