diff --git a/client/src/components/layout/Header.tsx b/client/src/components/layout/Header.tsx index 4127d7f..1851963 100644 --- a/client/src/components/layout/Header.tsx +++ b/client/src/components/layout/Header.tsx @@ -1,5 +1,10 @@ -import { Link, NavLink, useSearchParams } from 'react-router'; -import SearchBar from './SearchBar'; +import { Link, NavLink, useSearchParams } from 'react-router' +import SearchBar from './SearchBar' +import { Button } from '../ui/Button' +import { Dialog } from '../ui/Dialog' +import NewRecipePage, { + RecipeStepIndicator, +} from '../../routes/NewRecipePage' // Fokusmarkering ved tastaturnavigasjon const focusRing = @@ -72,9 +77,20 @@ export default function Header() {
  • - - Ny oppskrift - + + Ny Oppskrift + + } + title="Ny oppskrift" + headerContent={} + > + +
  • diff --git a/client/src/components/ui/Dialog.tsx b/client/src/components/ui/Dialog.tsx index 0801806..38b68c3 100644 --- a/client/src/components/ui/Dialog.tsx +++ b/client/src/components/ui/Dialog.tsx @@ -4,10 +4,16 @@ import * as RadixDialog from '@radix-ui/react-dialog' type DialogProps = { trigger: ReactNode title: string + headerContent?: ReactNode children: ReactNode } -export function Dialog({ trigger, title, children }: DialogProps) { +export function Dialog({ + trigger, + title, + headerContent, + children, +}: DialogProps) { return ( {/* Elementet som åpner dialogen */} @@ -28,35 +34,42 @@ export function Dialog({ trigger, title, children }: DialogProps) { -
    + {/* Header */} +
    + + {/* Tittel */} {title} + {/* Stegindikator */} +
    + {headerContent} +
    + + {/* Lukk */} - {children} -
    + + Skjema for å opprette en ny oppskrift + + {/* Innholdet i dialogen */} +
    + {children} +
    diff --git a/client/src/index.css b/client/src/index.css index 8bd04d2..a1eecab 100644 --- a/client/src/index.css +++ b/client/src/index.css @@ -1,4 +1,5 @@ -@import url('https://fonts.googleapis.com/css2?family=Mrs+Saint+Delafield&family=Tangerine:wght@400;700&display=swap" rel="stylesheet'); +@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Tangerine:wght@400;700&display=swap'); + @import "tailwindcss"; @@ -18,7 +19,7 @@ --color-peach: #efd7c4; /* Typografi */ - --font-heading: "Mrs Saint Delafield", Georgia, serif; + --font-heading: "Tangerine", cursive; --font-body: "DM Sans", Arial, sans-serif; /* Border radius */ @@ -53,4 +54,65 @@ body { #root { min-height: 100vh; -} \ No newline at end of file +} + +/* Skjema */ + +.form-label { + display: block; + margin-bottom: 0.5rem; + font-size: 0.875rem; + font-weight: 600; +} + +.form-input { + width: 100%; + border: 1px solid var(--color-peach); + border-radius: var(--radius-medium); + background-color: var(--color-background); + padding: 0.5rem 1rem; + font-size: 0.875rem; +} + +.form-input:focus-visible { + outline: 2px solid var(--color-primary); +} + +.upload-button { + display: flex; + height: 140px; + width: 100%; + flex-direction: column; + align-items: center; + justify-content: center; + + border: 1px dashed var(--color-peach); + border-radius: var(--radius-medium); + background-color: var(--color-background); +} + +.upload-button:hover { + background-color: color-mix( + in srgb, + var(--color-peach) 20%, + transparent + ); +} + +.upload-button:focus-visible { + outline: 2px solid var(--color-primary); +} + +.stepper-button { + height: 2rem; + width: 2rem; + border: none; + border-radius: var(--radius-small); + background-color: var(--color-peach); + cursor: pointer; +} + +.stepper-button:hover { + background-color: var(--color-pink-light); +} + diff --git a/client/src/routes/HomePage.tsx b/client/src/routes/HomePage.tsx index 2ee9f82..2b58be0 100644 --- a/client/src/routes/HomePage.tsx +++ b/client/src/routes/HomePage.tsx @@ -1,6 +1,54 @@ -// TODO: vise oppskrifter pent men slideshow elns og vise populære oppskrifter +import { useState } from 'react' +import { Tag } from '../components/ui/Tag' + + + export default function HomePage() { + const [vegetarSelected, setVegetarSelected] = useState(false) + const [middagSelected, setMiddagSelected] = useState(false) + return ( -

    Hva frister i dag?

    - ); -} +
    + +
    + + {/* Slideshow-placeholder */} +
    + Slideshow kommer her +
    + + + + {/* Filter-tags */} +
    + setVegetarSelected(!vegetarSelected)} + > + Vegetar + + + setMiddagSelected(!middagSelected)} + > + Middag + + + Italiensk + Glutenfri +
    + +
    +
    + ) +} \ No newline at end of file diff --git a/client/src/routes/NewRecipePage.tsx b/client/src/routes/NewRecipePage.tsx index 626ba20..f366e07 100644 --- a/client/src/routes/NewRecipePage.tsx +++ b/client/src/routes/NewRecipePage.tsx @@ -1,4 +1,273 @@ -// TODO: popup eller skjema for ny oppskrift -export default function NewRecipePage() { - return

    Ny oppskrift

    ; +import { useState } from 'react' +import { Button } from '../components/ui/Button' +import { Tag } from '../components/ui/Tag' +import Rating from '@mui/material/Rating'; + +const STEPS = ['Oppskrift', 'Ingredienser', 'Fremgangsmåte', 'Publiser'] +const CATEGORIES = ['Frokost','Lunsj','Middag','Dessert','Annet',] +const TAGS = ['Vegetar','Vegan','Glutenfri','Laktosefri','Under 30 min',] +export function RecipeStepIndicator() { + return ( +
      + {STEPS.map((step, index) => { + const active = index === 0 + + return ( +
    1. + {/* Linje mellom stegene */} + {index > 0 && ( +
      + )} + +
      + {/* Nummer */} + + {index + 1} + + + {/* Navn */} + + {step} + +
      +
    2. + ) + })} +
    + ) } +export default function NewRecipePage() { + const [category, setCategory] = useState('Middag') + const [selectedTags, setSelectedTags] = useState([ + 'Vegetar', + 'Glutenfri', + ]) + const [servings, setServings] = useState(4) + // Velger eller fjerner en tag + const toggleTag = (tag: string) => { + if (selectedTags.includes(tag)) { + setSelectedTags( + selectedTags.filter((item) => item !== tag), + ) + } else { + setSelectedTags([...selectedTags, tag]) + } + } + + return ( +
    + + + {/* TO KOLONNER */} +
    + {/* VENSTRE SIDE */} +
    + + {/* Bilde */} +
    +

    + Bilde av retten * +

    + + +
    + + {/* Kort beskrivelse */} + +
    + + +