mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-07 13:38:15 -08:00
fix: a couple ui fixes (#147)
* fix: reduce loading component width * improve theme selector for mobile * match interest graph width to activity grid
This commit is contained in:
parent
1eb1cd0fd5
commit
aa7fddd518
5 changed files with 43 additions and 23 deletions
|
|
@ -68,14 +68,14 @@ export default function ActivityGrid({
|
|||
|
||||
if (isPending) {
|
||||
return (
|
||||
<div className="w-[500px]">
|
||||
<div className="w-[350px]">
|
||||
<h3>Activity</h3>
|
||||
<p>Loading...</p>
|
||||
</div>
|
||||
);
|
||||
} else if (isError) {
|
||||
return (
|
||||
<div className="w-[500px]">
|
||||
<div className="w-[350px]">
|
||||
<h3>Activity</h3>
|
||||
<p className="error">Error: {error.message}</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export default function AllTimeStats() {
|
|||
|
||||
if (isPending) {
|
||||
return (
|
||||
<div className="w-[200px]">
|
||||
<div>
|
||||
<h3>{header}</h3>
|
||||
<p>Loading...</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -48,14 +48,14 @@ export default function InterestGraph({
|
|||
|
||||
if (isPending) {
|
||||
return (
|
||||
<div className="w-[500px]">
|
||||
<div className="w-[350px] sm:w-[500px]">
|
||||
<h3>Interest over time</h3>
|
||||
<p>Loading...</p>
|
||||
</div>
|
||||
);
|
||||
} else if (isError) {
|
||||
return (
|
||||
<div className="w-[500px]">
|
||||
<div className="w-[350px] sm:w-[500px]">
|
||||
<h3>Interest over time</h3>
|
||||
<p className="error">Error: {error.message}</p>
|
||||
</div>
|
||||
|
|
@ -67,7 +67,7 @@ export default function InterestGraph({
|
|||
// so I think I just have to remove it for now.
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-start w-full max-w-[500px]">
|
||||
<div className="flex flex-col items-start w-full max-w-[335px] sm:max-w-[500px]">
|
||||
<h3>Interest over time</h3>
|
||||
<AreaChart
|
||||
style={{
|
||||
|
|
|
|||
|
|
@ -1,23 +1,43 @@
|
|||
import type { Theme } from "~/styles/themes.css";
|
||||
|
||||
interface Props {
|
||||
theme: Theme
|
||||
themeName: string
|
||||
setTheme: Function
|
||||
theme: Theme;
|
||||
themeName: string;
|
||||
setTheme: Function;
|
||||
}
|
||||
|
||||
export default function ThemeOption({ theme, themeName, setTheme }: Props) {
|
||||
|
||||
const capitalizeFirstLetter = (s: string) => {
|
||||
return s.charAt(0).toUpperCase() + s.slice(1);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div onClick={() => setTheme(themeName)} className="rounded-md p-3 sm:p-5 hover:cursor-pointer flex gap-4 items-center border-2" style={{background: theme.bg, color: theme.fg, borderColor: theme.bgSecondary}}>
|
||||
<div className="text-xs sm:text-sm">{capitalizeFirstLetter(themeName)}</div>
|
||||
<div className="w-[50px] h-[30px] rounded-md" style={{background: theme.bgSecondary}}></div>
|
||||
<div className="w-[50px] h-[30px] rounded-md" style={{background: theme.fgSecondary}}></div>
|
||||
<div className="w-[50px] h-[30px] rounded-md" style={{background: theme.primary}}></div>
|
||||
<div
|
||||
onClick={() => setTheme(themeName)}
|
||||
className="rounded-md p-3 sm:p-5 hover:cursor-pointer flex gap-3 items-center border-2 justify-between"
|
||||
style={{
|
||||
background: theme.bg,
|
||||
color: theme.fg,
|
||||
borderColor: theme.bgSecondary,
|
||||
}}
|
||||
>
|
||||
<div className="text-xs sm:text-sm">
|
||||
{capitalizeFirstLetter(themeName)}
|
||||
</div>
|
||||
)
|
||||
<div className="flex gap-2 w-full">
|
||||
<div
|
||||
className="w-2/7 max-w-[50px] h-[30px] rounded-md"
|
||||
style={{ background: theme.bgSecondary }}
|
||||
></div>
|
||||
<div
|
||||
className="w-2/7 max-w-[50px] h-[30px] rounded-md"
|
||||
style={{ background: theme.fgSecondary }}
|
||||
></div>
|
||||
<div
|
||||
className="w-2/7 max-w-[50px] h-[30px] rounded-md"
|
||||
style={{ background: theme.primary }}
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ export function ThemeSwitcher() {
|
|||
<AsyncButton onClick={resetTheme}>Reset</AsyncButton>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 items-center gap-2">
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 items-center gap-2">
|
||||
{Object.entries(themes).map(([name, themeData]) => (
|
||||
<ThemeOption
|
||||
setTheme={setTheme}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue