mirror of
https://github.com/Snigdha-OS/package-browser.git
synced 2025-12-06 16:13:52 +01:00
feat: use JSX.Element as component type
This commit is contained in:
@@ -2,7 +2,12 @@ import { useState, useEffect, useCallback } from 'react';
|
||||
import { Package } from '../types';
|
||||
import { fetchPackages } from '../services/api';
|
||||
|
||||
export function usePackages() {
|
||||
export function usePackages(): {
|
||||
packages: Package[];
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
retryLoading: () => void;
|
||||
} {
|
||||
const [packages, setPackages] = useState<Package[]>([]);
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
type Theme = 'light' | 'dark';
|
||||
import {
|
||||
Theme
|
||||
} from '../types';
|
||||
|
||||
export function useTheme() {
|
||||
export function useTheme(): {
|
||||
theme: Theme;
|
||||
toggleTheme: () => void;
|
||||
} {
|
||||
const getInitialTheme = (): Theme => {
|
||||
const savedTheme = localStorage.getItem('theme') as Theme;
|
||||
if (savedTheme === 'dark' || savedTheme === 'light') return savedTheme;
|
||||
|
||||
Reference in New Issue
Block a user