LibreChat/client/src/components/ui/ThemeSelector.tsx

40 lines
1 KiB
TypeScript
Raw Normal View History

import React, { useContext, useCallback } from 'react';
import { Sun, Moon } from 'lucide-react';
import { ThemeContext } from '~/hooks';
const Theme = ({ theme, onChange }: { theme: string; onChange: (value: string) => void }) => {
const themeIcons = {
system: <Sun />,
dark: <Moon color="white" />,
light: <Sun />,
};
return (
<div className="flex items-center justify-between">
<div className="cursor-pointer" onClick={() => onChange(theme === 'dark' ? 'light' : 'dark')}>
{themeIcons[theme]}
</div>
</div>
);
};
const ThemeSelector = () => {
const { theme, setTheme } = useContext(ThemeContext);
const changeTheme = useCallback(
(value: string) => {
setTheme(value);
},
[setTheme],
);
return (
🪟 fix+feat: General UI Enhancements (#2619) * feat: Minor design changes to mimic OpenAI's latest login page * fix: Optimize ThemeSelector for mobile * fix: Use a svg for the logo for transperency in dark mode * feat: Update styles for Registration * feat: Update error colors for login & registration * fix: remove medium font * wip: Dropdown menu * feat: Update dropdown to match ChatGPT * feat: Improve rounding and padding * feat: Add UI Updates to RequestPasswordReset, PasswordRest and increase width for theme dropdown * fix: Modify the My Files modal's width to not touch the screen * feat: fix scrolling for dropdown, and make border width lighter * feat: Match popup menu design to OpenAI (p1/2) * fix+feat: fix dark mode, add user email, add lighter borders * fix: Add border color on focus of chat input. * feat: Move Export Conversation to a seperate button (testing) * fix: Properly center Login, Registration, Reset Password Flow * fix: Border colors on dark mode for settings modal * feat: Improve wording for settings menu * fix: Optimize settings modal for mobile and fix height for modal * feat: Optimize for desktop * fix: make TooltipTrigger asChild of button, improve settings mobile responsiveness * feat: Handle dropdowns properly TODO: Make height dynamic, fix dark mode colors * fix: input styles fix: make endpoint icon smaller * feat: Update UI to Match ChatGPT Style - Updated the dropdown styles to match the aesthetic of ChatGPT. - Decreased spacing within the conversation area for cleanliness. - Replaced the current archive icon with the ChatGPT's icon. * fix: fix colors for EditMenuButton & ArchiveButton for dark mode and light mode * fix: ui fixes * fix: Fix Conversation UI Bugs * fix: transparency of HoverToggle to make buttons not visible * fix: dark mode HoverToggle & compress menu item spacing * fix: responsiveness of export icon * fix: first mentionitem is set to always be highlighted * fix: improve hover state to text instead of bg * feat: Update icons to ChatGPT Style * fix: dark mode hover for PanelFileCell * fix: change navlinks z-index to 100 * fix: hover states for DataTable * feat: Move ExportButton to seperate component * chore: remove unused imports
2024-05-10 03:16:16 +05:30
<div className="flex flex-col items-center justify-center bg-white pt-6 dark:bg-gray-900 sm:pt-0">
<div className="absolute bottom-0 left-0 m-4">
<Theme theme={theme} onChange={changeTheme} />
</div>
</div>
);
};
export default ThemeSelector;