Style and position settings button

This commit is contained in:
araemer 2025-12-07 08:10:27 +01:00
parent 5b83a783aa
commit df39a1a217
5 changed files with 31 additions and 21 deletions

View file

@ -22,6 +22,10 @@ export const ButtonType = {
textColor: "text-white", textColor: "text-white",
backgroundColor: "bg-gray-600 hover:bg-gray-800", backgroundColor: "bg-gray-600 hover:bg-gray-800",
}, },
LightButton: {
textColor: "text-gray-600",
backgroundColor: "bg-white hover:bg-gray-300",
},
PrimaryButton: { PrimaryButton: {
textColor: "text-gray-600", textColor: "text-gray-600",
backgroundColor: "bg-blue-300 hover:bg-blue-400", backgroundColor: "bg-blue-300 hover:bg-blue-400",

View file

@ -6,6 +6,7 @@ import clsx from "clsx";
type CircularIconButtonProps = { type CircularIconButtonProps = {
icon: LucideIcon; icon: LucideIcon;
onClick: () => void; onClick: () => void;
buttonType?: ButtonType
disabled?: boolean; disabled?: boolean;
className?: string; className?: string;
}; };
@ -17,14 +18,16 @@ export default function CircularIconButton({
onClick, onClick,
icon: Icon, icon: Icon,
className = "", className = "",
buttonType = ButtonType.PrimaryButton,
disabled = false, disabled = false,
...props ...props
}: CircularIconButtonProps) { }: CircularIconButtonProps) {
return ( return (
<button <button
className={clsx( className={clsx(
"flex-shrink-0 w-7 h-7 rounded-full text-white flex items-center justify-center shadow-sm", "flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center shadow-sm",
ButtonType.PrimaryButton.backgroundColor, buttonType.backgroundColor,
buttonType?.textColor,
className)} className)}
onClick={onClick} onClick={onClick}
disabled={disabled} disabled={disabled}

View file

@ -12,7 +12,7 @@ type NumberCircleProps = React.HTMLAttributes<HTMLDivElement> & {
* Can be used as a standalone indicator or as a drag handle. * Can be used as a standalone indicator or as a drag handle.
* Accepts any div attributes (e.g. `className`, `title`, `onClick`, or DnD listeners). * Accepts any div attributes (e.g. `className`, `title`, `onClick`, or DnD listeners).
*/ */
export function NumberCircle({ number, className, ...rest }: NumberCircleProps) { export function NumberCircle({number, className, ...rest}: NumberCircleProps) {
return ( return (
<div <div
{...rest} {...rest}
@ -21,9 +21,9 @@ export function NumberCircle({ number, className, ...rest }: NumberCircleProps)
"flex items-center justify-center shadow-sm", "flex items-center justify-center shadow-sm",
"cursor-default select-none", "cursor-default select-none",
className className
)} )}
> >
{number} {number}
</div> </div>
); );
} }

View file

@ -50,6 +50,7 @@ export function NumberStepControl({
className)}> className)}>
<CircularIconButton <CircularIconButton
onClick={handleDecrease} onClick={handleDecrease}
className={"text-white"}
icon={Minus} icon={Minus}
/> />
@ -64,6 +65,7 @@ export function NumberStepControl({
<CircularIconButton <CircularIconButton
onClick={handleIncrease} onClick={handleIncrease}
className={"text-white"}
icon={Plus} icon={Plus}
/> />

View file

@ -3,6 +3,8 @@ import React, {type ReactNode, useState} from "react";
import clsx from "clsx"; import clsx from "clsx";
import {Settings} from "lucide-react"; import {Settings} from "lucide-react";
import {SettingsMenu} from "../SettingsMenu"; import {SettingsMenu} from "../SettingsMenu";
import CircularIconButton from "./CircularIconButton.tsx";
import {ButtonType} from "./BasicButtonDefinitions.ts";
/** /**
* Layout wrapper for the main content area of a page. * Layout wrapper for the main content area of a page.
@ -28,14 +30,13 @@ export default function PageContentLayout({
className className
)} )}
> >
{/* Settings Button (top-right) */} {/* Settings Button (top-right) - Sticky with higher z-index than header */}
<button <CircularIconButton
onClick={() => setIsMenuOpen(true)} onClick={() => setIsMenuOpen(true)}
className="absolute top-4 right-4 p-2 rounded-full bg-white hover:bg-gray-200 shadow transition" buttonType={ButtonType.LightButton}
title="Einstellungen" className="sticky top-4 float-right w-10 h-10 z-20 mb-[-40px]"
> icon={Settings}
<Settings size={20}/> />
</button>
{/* Page content */} {/* Page content */}
{children} {children}