From 5dec0091485d915b38221eaee452b2e276207141 Mon Sep 17 00:00:00 2001 From: xenia_grib Date: Wed, 9 Sep 2026 11:57:40 +0200 Subject: [PATCH 1/7] feat: add initial forward, backward and favorite buttons + styling --- t29-project-1/src/App.css | 200 +++--------------- t29-project-1/src/App.tsx | 125 ++--------- .../src/components/ActionButtons.tsx | 37 ++++ 3 files changed, 77 insertions(+), 285 deletions(-) create mode 100644 t29-project-1/src/components/ActionButtons.tsx diff --git a/t29-project-1/src/App.css b/t29-project-1/src/App.css index f90339d..c63f891 100644 --- a/t29-project-1/src/App.css +++ b/t29-project-1/src/App.css @@ -1,184 +1,38 @@ -.counter { - font-size: 16px; - padding: 5px 10px; - border-radius: 5px; - color: var(--accent); - background: var(--accent-bg); - border: 2px solid transparent; - transition: border-color 0.3s; - margin-bottom: 24px; +/* Tøm hele den gamle App.css og lim inn dette */ - &:hover { - border-color: var(--accent-border); - } - &:focus-visible { - outline: 2px solid var(--accent); - outline-offset: 2px; - } +main { + max-width: 600px; + margin: 0 auto; + padding: 2rem 1rem; + text-align: center; } -.hero { - position: relative; - - .base, - .framework, - .vite { - inset-inline: 0; - margin: 0 auto; - } - - .base { - width: 170px; - position: relative; - z-index: 0; - } - - .framework, - .vite { - position: absolute; - } - - .framework { - z-index: 1; - top: 34px; - height: 28px; - transform: perspective(2000px) rotateZ(300deg) rotateX(44deg) rotateY(39deg) - scale(1.4); - } - - .vite { - z-index: 0; - top: 107px; - height: 26px; - width: auto; - transform: perspective(2000px) rotateZ(300deg) rotateX(40deg) rotateY(39deg) - scale(0.8); - } -} - -#center { - display: flex; - flex-direction: column; - gap: 25px; - place-content: center; - place-items: center; - flex-grow: 1; - - @media (max-width: 1024px) { - padding: 32px 20px 24px; - gap: 18px; - } -} - -#next-steps { - display: flex; - border-top: 1px solid var(--border); - text-align: left; - - & > div { - flex: 1 1 0; - padding: 32px; - @media (max-width: 1024px) { - padding: 24px 20px; - } - } - - .icon { - margin-bottom: 16px; - width: 22px; - height: 22px; - } - - @media (max-width: 1024px) { - flex-direction: column; - text-align: center; - } -} - -#docs { - border-right: 1px solid var(--border); - - @media (max-width: 1024px) { - border-right: none; - border-bottom: 1px solid var(--border); - } -} - -#next-steps ul { +/* Nullstill listestilen for WCAG-navigasjonen og legg knappene på rad */ +nav[aria-label="navigation"] ul { list-style: none; padding: 0; + margin: 2rem 0; display: flex; - gap: 8px; - margin: 32px 0 0; - - .logo { - height: 18px; - } - - a { - color: var(--text-h); - font-size: 16px; - border-radius: 6px; - background: var(--social-bg); - display: flex; - padding: 6px 12px; - align-items: center; - gap: 8px; - text-decoration: none; - transition: box-shadow 0.3s; - - &:hover { - box-shadow: var(--shadow); - } - .button-icon { - height: 18px; - width: 18px; - } - } - - @media (max-width: 1024px) { - margin-top: 20px; - flex-wrap: wrap; - justify-content: center; - - li { - flex: 1 1 calc(50% - 8px); - } - - a { - width: 100%; - justify-content: center; - box-sizing: border-box; - } - } + gap: 1rem; + justify-content: center; + align-items: center; } -#spacer { - height: 88px; - border-top: 1px solid var(--border); - @media (max-width: 1024px) { - height: 48px; - } +/* Enkel styling for knappene */ +nav[aria-label="navigation"] button { + padding: 0.75rem 1.25rem; + font-size: 1rem; + border-radius: 8px; + border: 1px solid #ccc; + background-color: #f9f9f9; + cursor: pointer; + transition: background-color 0.2s ease, transform 0.1s ease; } -.ticks { - position: relative; - width: 100%; - - &::before, - &::after { - content: ''; - position: absolute; - top: -4.5px; - border: 5px solid transparent; - } - - &::before { - left: 0; - border-left-color: var(--border); - } - &::after { - right: 0; - border-right-color: var(--border); - } +nav[aria-label="navigation"] button:hover { + background-color: #eee; } + +nav[aria-label="navigation"] button:active { + transform: scale(0.98); +} \ No newline at end of file diff --git a/t29-project-1/src/App.tsx b/t29-project-1/src/App.tsx index 9ca8e8d..c6e4f97 100644 --- a/t29-project-1/src/App.tsx +++ b/t29-project-1/src/App.tsx @@ -1,122 +1,23 @@ import { useState } from 'react' -import heroImg from './assets/hero.png' -import reactLogo from './assets/react.svg' -import viteLogo from './assets/vite.svg' import './App.css' +import { ActionButtons } from './components/ActionButtons' function App() { - const [count, setCount] = useState(0) + const [isFavorited, setIsFavorited] = useState(false) return ( - <> -
-
- - React logo - Vite logo -
-
-

Get started

-

- Edit src/App.tsx and save to test HMR -

-
- -
+
+ + {/* Her vil CatCard-komponenten din ligge etter hvert */} -
- -
-
- -

Documentation

-

Your questions, answered

- -
-
- -

Connect with us

-

Join the Vite community

- -
-
- -
-
- + console.log('Go to previous cat')} + onFavorite={() => setIsFavorited(!isFavorited)} + onNext={() => console.log('Go to next cat')} + isFavorited={isFavorited} + /> +
) } -export default App +export default App \ No newline at end of file diff --git a/t29-project-1/src/components/ActionButtons.tsx b/t29-project-1/src/components/ActionButtons.tsx new file mode 100644 index 0000000..72f40a0 --- /dev/null +++ b/t29-project-1/src/components/ActionButtons.tsx @@ -0,0 +1,37 @@ +interface ActionButtonsProps { + onPrevious: () => void; + onFavorite: () => void; + onNext: () => void; + isFavorited?: boolean; + } + + export const ActionButtons = ({ + onPrevious, + onFavorite, + onNext, + isFavorited = false + }: ActionButtonsProps) => { + return ( + /*