Update style

This commit is contained in:
Terncode committed 2026-10-17 11:27:41 +02:00
1 parent 917effe259
commit f1dc11111d
7 files changed
+458 -27

No files matched your search

+74 -1
View File
@@ -29,6 +29,9 @@ const Header = styled.header`
@media (max-width: ${theme.breakpoints.mobile}) {
padding: ${theme.spacing.sm}px ${theme.spacing.md}px;
flex-direction: column;
align-items: stretch;
gap: ${theme.spacing.sm}px;
}
`;
@@ -55,11 +58,56 @@ const Controls = styled.div`
display: flex;
align-items: center;
gap: ${theme.spacing.sm}px;
flex-wrap: wrap;
justify-content: flex-end;
@media (max-width: ${theme.breakpoints.mobile}) {
width: 100%;
justify-content: space-between;
gap: ${theme.spacing.xs}px;
}
`;
const MonthInput = styled.input.attrs({ type: "month" })`
min-width: 150px;
max-width: 200px;
@media (max-width: ${theme.breakpoints.mobile}) {
max-width: none;
min-height: 44px;
min-width: 130px;
flex: 1;
}
`;
const MonthNav = styled.div`
display: flex;
align-items: center;
gap: ${theme.spacing.xs}px;
button {
min-width: 40px;
padding-left: 10px;
padding-right: 10px;
font-size: 1.25rem;
line-height: 1;
}
@media (max-width: ${theme.breakpoints.mobile}) {
flex: 1 1 100%;
order: -1;
button {
min-width: 48px;
min-height: 44px;
font-size: 1.4rem;
}
input {
flex: 1;
min-width: 0;
}
}
`;
const Main = styled.main`
@@ -82,6 +130,14 @@ const SummaryGrid = styled.section`
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: ${theme.spacing.md}px;
@media (max-width: ${theme.breakpoints.mobileSmall}) {
grid-template-columns: repeat(2, 1fr);
> *:first-child {
grid-column: 1 / -1;
}
}
`;
const StatCard = styled.div<{ hero?: boolean }>`
@@ -92,6 +148,11 @@ const StatCard = styled.div<{ hero?: boolean }>`
display: flex;
flex-direction: column;
gap: ${theme.spacing.xs}px;
min-width: 0;
@media (max-width: ${theme.breakpoints.mobileSmall}) {
padding: ${theme.spacing.md}px;
}
`;
const StatLabel = styled.span`
@@ -142,6 +203,14 @@ const ErrorTitle = styled.h2`
const fmtMoney = (n: number) =>
Math.abs(n).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
function shiftMonth(month: string, delta: number): string {
const fallback = getMonth();
const match = /^(\d{4})-(\d{2})$/.exec(month || fallback);
if (!match) return fallback;
const d = new Date(Number(match[1]), Number(match[2]) - 1 + delta, 1);
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}`;
}
export function Page(props: { storage: WebsiteStorage, logout: () => void }) {
const [month, setMonth] = useState("");
const [data, setData] = useState<Data<Date>[]>([]);
@@ -300,7 +369,11 @@ export function Page(props: { storage: WebsiteStorage, logout: () => void }) {
<MonthBadge>{month}</MonthBadge>
</Brand>
<Controls>
<MonthInput aria-label="Select month" value={month} onChange={(d: ChangeEvent<HTMLInputElement>) => setDate(d.target.value)} />
<MonthNav>
<button onClick={() => setDate(shiftMonth(month, -1))} aria-label="Previous month" title="Previous month">‹</button>
<MonthInput aria-label="Select month" value={month} onChange={(d: ChangeEvent<HTMLInputElement>) => setDate(d.target.value)} />
<button onClick={() => setDate(shiftMonth(month, 1))} aria-label="Next month" title="Next month">›</button>
</MonthNav>
<button onClick={undo} disabled={past.length === 0} aria-label="Undo" title="Undo (Ctrl+Z)">Undo</button>
<button onClick={redo} disabled={future.length === 0} aria-label="Redo" title="Redo (Ctrl+Y)">Redo</button>
<button onClick={() => setSuggestionsOpen(true)}>Suggestions</button>