mirror of
				https://github.com/ItzCrazyKns/Perplexica.git
				synced 2025-11-03 20:28:14 +00:00 
			
		
		
		
	feat(components): use arrow function
This commit is contained in:
		@@ -11,7 +11,7 @@ import React, {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {}
 | 
					interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function Input({ className, ...restProps }: InputProps) {
 | 
					const Input = ({ className, ...restProps }: InputProps) => {
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <input
 | 
					    <input
 | 
				
			||||||
      {...restProps}
 | 
					      {...restProps}
 | 
				
			||||||
@@ -21,13 +21,13 @@ function Input({ className, ...restProps }: InputProps) {
 | 
				
			|||||||
      )}
 | 
					      )}
 | 
				
			||||||
    />
 | 
					    />
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
}
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
 | 
					interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
 | 
				
			||||||
  options: { value: string; label: string; disabled?: boolean }[];
 | 
					  options: { value: string; label: string; disabled?: boolean }[];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function Select({ className, options, ...restProps }: SelectProps) {
 | 
					const Select = ({ className, options, ...restProps }: SelectProps) => {
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <select
 | 
					    <select
 | 
				
			||||||
      {...restProps}
 | 
					      {...restProps}
 | 
				
			||||||
@@ -45,7 +45,7 @@ function Select({ className, options, ...restProps }: SelectProps) {
 | 
				
			|||||||
      })}
 | 
					      })}
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
}
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface SettingsType {
 | 
					interface SettingsType {
 | 
				
			||||||
  chatModelProviders: {
 | 
					  chatModelProviders: {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,11 +10,11 @@ import { Dialog, Transition } from '@headlessui/react';
 | 
				
			|||||||
import SettingsDialog from './SettingsDialog';
 | 
					import SettingsDialog from './SettingsDialog';
 | 
				
			||||||
import { ThemeSwitcher } from './theme/Switcher';
 | 
					import { ThemeSwitcher } from './theme/Switcher';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function VerticalIconContainer({ children }: { children: ReactNode }) {
 | 
					const VerticalIconContainer = ({ children }: { children: ReactNode }) => {
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <div className="flex flex-col items-center gap-y-3 w-full">{children}</div>
 | 
					    <div className="flex flex-col items-center gap-y-3 w-full">{children}</div>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
}
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const Sidebar = ({ children }: { children: React.ReactNode }) => {
 | 
					const Sidebar = ({ children }: { children: React.ReactNode }) => {
 | 
				
			||||||
  const segments = useSelectedLayoutSegments();
 | 
					  const segments = useSelectedLayoutSegments();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,14 +1,14 @@
 | 
				
			|||||||
'use client';
 | 
					'use client';
 | 
				
			||||||
import { ThemeProvider } from 'next-themes';
 | 
					import { ThemeProvider } from 'next-themes';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function ThemeProviderComponent({
 | 
					export const ThemeProviderComponent = ({
 | 
				
			||||||
  children,
 | 
					  children,
 | 
				
			||||||
}: {
 | 
					}: {
 | 
				
			||||||
  children: React.ReactNode;
 | 
					  children: React.ReactNode;
 | 
				
			||||||
}) {
 | 
					}) => {
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <ThemeProvider attribute="class" enableSystem={false} defaultTheme="dark">
 | 
					    <ThemeProvider attribute="class" enableSystem={false} defaultTheme="dark">
 | 
				
			||||||
      {children}
 | 
					      {children}
 | 
				
			||||||
    </ThemeProvider>
 | 
					    </ThemeProvider>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
}
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@ interface ThemeSwitcherProps {
 | 
				
			|||||||
  className?: string;
 | 
					  className?: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function ThemeSwitcher({ size, className }: ThemeSwitcherProps) {
 | 
					export const ThemeSwitcher = ({ size, className }: ThemeSwitcherProps) => {
 | 
				
			||||||
  const [mounted, setMounted] = useState(false);
 | 
					  const [mounted, setMounted] = useState(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const { theme, setTheme } = useTheme();
 | 
					  const { theme, setTheme } = useTheme();
 | 
				
			||||||
@@ -69,4 +69,4 @@ export function ThemeSwitcher({ size, className }: ThemeSwitcherProps) {
 | 
				
			|||||||
      onClick={() => handleThemeSwitch('system')}
 | 
					      onClick={() => handleThemeSwitch('system')}
 | 
				
			||||||
    />
 | 
					    />
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
}
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user