Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions app/profile/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { Post } from "@/components/posts";
import { posts } from "@/components/types/post";
import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox";
import { signOut, useSession } from "next-auth/react";
import { useEffect, useState } from "react";

Expand All @@ -20,16 +21,21 @@ const LanguageMenu = () => {
}, [language]);

return (
<div className="flex items-center gap-2">
<label className="flex items-center gap-1 text-sm">
<input
type="checkbox"
<>
<div className="flex items-center space-x-2">
<Checkbox
id="terms"
checked={language == "en"}
onChange={() => setLanguage(language == "en" ? "no" : "en")}
onCheckedChange={() => setLanguage(language == "en" ? "no" : "en")}
/>
Bergenser-modus
</label>
</div>
<label
htmlFor="terms"
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
>
Bergenser-modus
</label>
</div>
</>
);
};

Expand Down
3 changes: 2 additions & 1 deletion app/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { signIn } from "next-auth/react";
import { useState } from "react";
import Link from "next/link";
import { Checkbox } from "@/components/ui/checkbox";

export default function RegisterPage() {
const [email, setEmail] = useState("");
Expand Down Expand Up @@ -79,8 +80,8 @@ export default function RegisterPage() {
placeholder="Gjenta passord"
/>
<div className="flex items-center gap-2 flex-row">
<Checkbox onChange={() => setCreep(!creep)} />
<label>Jeg er ikke creep</label>
<input type="checkbox" onChange={() => setCreep(!creep)} />
</div>
{error && <p className="text-red-500 text-center">{error}</p>}
<button
Expand Down
2 changes: 1 addition & 1 deletion components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function Header() {
{title}
</Link>

<div className="mt-4 md:mt-0 md:ml-auto flex items-center gap-2 flex-col md:mr-6">
<div className="mt-4 md:mt-0 md:ml-auto flex items-center gap-2 flex-col">
<AuthButtons />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion components/profile-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function ProfileButton({ userId }: { userId: number }) {
return (
<Link
href={`/profile/${userId}`}
className="h-10 w-10 bg-background rounded-full flex justify-center items-center text-foreground"
className="h-10 w-10 bg-background rounded-full flex justify-center items-center text-foreground mx-6"
>
<User className="h-6 w-6" />
</Link>
Expand Down
31 changes: 31 additions & 0 deletions components/ui/checkbox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"use client";

import * as React from "react";
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
import { CheckIcon } from "lucide-react";
import { cn } from "../lib/utils";

function Checkbox({
className,
...props
}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
return (
<CheckboxPrimitive.Root
data-slot="checkbox"
className={cn(
"peer border-muted dark:bg-input/30 data-[state=checked]:bg-muted data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-muted data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
className
)}
{...props}
>
<CheckboxPrimitive.Indicator
data-slot="checkbox-indicator"
className="flex items-center justify-center text-current transition-none"
>
<CheckIcon className="size-3.5" />
</CheckboxPrimitive.Indicator>
</CheckboxPrimitive.Root>
);
}

export { Checkbox };
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
"lint": "next lint"
},
"dependencies": {
"@radix-ui/react-checkbox": "^1.1.4",
"@radix-ui/react-slot": "^1.1.2",
"@supabase/ssr": "^0.6.1",
"@supabase/supabase-js": "^2.49.3",
"@radix-ui/react-slot": "^1.1.2",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"framer-motion": "^12.6.2",
Expand Down
190 changes: 182 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.