mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
9c2dccaad6
- RGBA color picker with live preview (debounce 50ms) - 30 preset colors + 12 theme presets (Ocean, Forest, Sunset, Royal, etc.) - Header image selection from configurable image library - Export/Import theme as JSON via clipboard - CSS variable theming across all UI elements: NitroCard headers/tabs, context menus, buttons (primary/dark/gray), InfoStand, toolbar, room tools, purse, progress bars, sliders - All elements use var(--name, fallback) for zero visual change when default - Smooth 0.3s CSS transitions on theme change - Server-side persistence via WebSocket (packets 10047/10048) - Integrated Color/Image tabs into BackgroundsView panel - All strings use LocalizeText() for i18n support - Settings persisted in localStorage + server sync with 1s debounce - Added react-colorful dependency
33 lines
1.4 KiB
TypeScript
33 lines
1.4 KiB
TypeScript
import { FC, useMemo } from 'react';
|
|
import { Base, Column, ColumnProps, Flex } from '..';
|
|
|
|
interface LayoutProgressBarProps extends ColumnProps
|
|
{
|
|
text?: string;
|
|
progress: number;
|
|
maxProgress?: number;
|
|
}
|
|
|
|
export const LayoutProgressBar: FC<LayoutProgressBarProps> = props =>
|
|
{
|
|
const { text = '', progress = 0, maxProgress = 100, position = 'relative', justifyContent = 'center', classNames = [], children = null, ...rest } = props;
|
|
|
|
const getClassNames = useMemo(() =>
|
|
{
|
|
const newClassNames: string[] = [ 'border border-[solid] border-[#fff] p-[2px] h-[20px] rounded-[.25rem] overflow-hidden', 'text-white' ];
|
|
|
|
if(classNames.length) newClassNames.push(...classNames);
|
|
|
|
return newClassNames;
|
|
}, [ classNames ]);
|
|
|
|
return (
|
|
<Column classNames={ getClassNames } justifyContent={ justifyContent } position={ position } style={ { backgroundColor: 'var(--ui-accent-color, #1E7295)' } } { ...rest }>
|
|
{ text && (text.length > 0) &&
|
|
<Flex center fit className="[text-shadow:0px_4px_4px_rgba(0,0,0,.25)] z-20" position="absolute">{ text }</Flex> }
|
|
<Base className="h-full z-10 [transition:all_1s] rounded-[.125rem] bg-[repeating-linear-gradient(#2DABC2,#2DABC2_50%,#2B91A7_50%,#2B91A7_100%)]" style={ { width: (~~((((progress - 0) * (100 - 0)) / (maxProgress - 0)) + 0) + '%') } } />
|
|
{ children }
|
|
</Column>
|
|
);
|
|
};
|