From 0a6ecfe3d2e3af5743719eb9415a2697fa1d454f Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Thu, 8 Dec 2022 23:43:43 -0800 Subject: [PATCH] Implement react-basics styles. Fix queries. --- components/common/Button.module.css | 34 +- components/common/ButtonGroup.module.css | 12 +- components/common/Calendar.module.css | 22 +- components/common/Checkbox.module.css | 2 +- components/common/Dot.module.css | 2 +- components/common/Dropdown.module.css | 4 +- components/common/ErrorMessage.module.css | 2 +- components/common/FilterLink.module.css | 4 +- components/common/Link.module.css | 6 +- components/common/Loading.module.css | 6 +- components/common/Menu.module.css | 12 +- components/common/MenuButton.module.css | 6 +- components/common/MobileMenu.module.css | 2 +- components/common/Modal.module.css | 4 +- components/common/NavMenu.module.css | 8 +- components/common/NoData.module.css | 4 +- components/common/Table.module.css | 8 +- components/common/Tag.module.css | 2 +- components/common/Toast.module.css | 2 +- components/common/UpdateNotice.module.css | 2 +- components/forms/DatePickerForm.module.css | 2 +- components/forms/EventDataForm.module.css | 4 +- components/forms/Form.module.css | 4 +- components/layout/Footer.module.css | 2 +- components/layout/FormLayout.module.css | 6 +- components/layout/GridLayout.module.css | 6 +- components/layout/Header.module.css | 4 +- components/layout/Layout.js | 18 +- components/layout/MenuLayout.module.css | 4 +- components/layout/Page.module.css | 3 +- components/metrics/ActiveUsers.module.css | 2 +- components/metrics/ChartTooltip.module.css | 6 +- components/metrics/DataTable.module.css | 10 +- components/metrics/Legend.module.css | 4 +- components/metrics/MetricCard.module.css | 8 +- components/metrics/MetricsTable.module.css | 2 +- components/metrics/RealtimeLog.module.css | 6 +- components/metrics/WebsiteChart.module.css | 4 +- components/metrics/WebsiteHeader.js | 62 +- components/metrics/WebsiteHeader.module.css | 29 +- components/pages/DashboardEdit.module.css | 10 +- components/pages/TestConsole.js | 26 +- components/pages/TestConsole.module.css | 2 +- components/pages/WebsiteDetails.js | 68 +- components/pages/WebsiteDetails.module.css | 4 +- components/pages/WebsiteList.module.css | 2 +- components/settings/SettingsButton.module.css | 4 +- components/settings/UserButton.module.css | 4 +- pages/_app.js | 23 +- pages/api/auth/login.ts | 2 +- pages/api/realtime/init.ts | 2 +- pages/api/websites/[id]/eventdata.ts | 3 +- pages/api/websites/[id]/events.ts | 3 +- pages/api/websites/[id]/index.ts | 3 +- pages/api/websites/[id]/metrics.ts | 3 +- .../analytics/pageview/getPageviewMetrics.ts | 7 +- styles/bootstrap-grid.css | 3981 ----------------- styles/index.css | 29 +- styles/variables.css | 57 +- 59 files changed, 227 insertions(+), 4336 deletions(-) delete mode 100644 styles/bootstrap-grid.css diff --git a/components/common/Button.module.css b/components/common/Button.module.css index b911095f..2327db9e 100644 --- a/components/common/Button.module.css +++ b/components/common/Button.module.css @@ -2,9 +2,9 @@ display: flex; justify-content: center; align-items: center; - font-size: var(--font-size-normal); - color: var(--gray900); - background: var(--gray100); + font-size: var(--font-size-md); + color: var(--base900); + background: var(--base100); padding: 8px 16px; border-radius: 4px; border: 0; @@ -14,11 +14,11 @@ } .button:hover { - background: var(--gray200); + background: var(--base200); } .button:active { - color: var(--gray900); + color: var(--base900); } .label { @@ -33,26 +33,26 @@ } .small { - font-size: var(--font-size-small); + font-size: var(--font-size-sm); } .xsmall { - font-size: var(--font-size-xsmall); + font-size: var(--font-size-xs); } .action, .action:active { - color: var(--gray50); - background: var(--gray900); + color: var(--base50); + background: var(--base900); } .action:hover { - background: var(--gray800); + background: var(--base800); } .danger, .danger:active { - color: var(--gray50); + color: var(--base50); background: var(--red500); } @@ -62,7 +62,7 @@ .light, .light:active { - color: var(--gray900); + color: var(--base900); background: transparent; } @@ -85,18 +85,18 @@ .button:disabled { cursor: default; - color: var(--gray500); - background: var(--gray75); + color: var(--base500); + background: var(--base75); } .button:disabled:active { - color: var(--gray500); + color: var(--base500); } .button:disabled:hover { - background: var(--gray75); + background: var(--base75); } .button.light:disabled { - background: var(--gray50); + background: var(--base50); } diff --git a/components/common/ButtonGroup.module.css b/components/common/ButtonGroup.module.css index bc60f8d3..04d33d22 100644 --- a/components/common/ButtonGroup.module.css +++ b/components/common/ButtonGroup.module.css @@ -2,14 +2,14 @@ display: inline-flex; border-radius: 4px; overflow: hidden; - border: 1px solid var(--gray500); + border: 1px solid var(--base500); } .group .button { border-radius: 0; - color: var(--gray800); - background: var(--gray50); - border-left: 1px solid var(--gray500); + color: var(--base800); + background: var(--base50); + border-left: 1px solid var(--base500); padding: 4px 8px; } @@ -18,7 +18,7 @@ } .group .button:hover { - background: var(--gray100); + background: var(--base100); } .group .button + .button { @@ -26,6 +26,6 @@ } .group .button.selected { - color: var(--gray900); + color: var(--base900); font-weight: 600; } diff --git a/components/common/Calendar.module.css b/components/common/Calendar.module.css index 9751cf25..5e50e79a 100644 --- a/components/common/Calendar.module.css +++ b/components/common/Calendar.module.css @@ -1,7 +1,7 @@ .calendar { display: flex; flex-direction: column; - font-size: var(--font-size-small); + font-size: var(--font-size-sm); flex: 1; min-height: 306px; } @@ -12,7 +12,7 @@ } .calendar td { - color: var(--gray800); + color: var(--base800); cursor: pointer; text-align: center; vertical-align: center; @@ -23,17 +23,17 @@ } .calendar td:hover { - border: 1px solid var(--gray300); - background: var(--gray75); + border: 1px solid var(--base300); + background: var(--base75); } .calendar td.faded { - color: var(--gray500); + color: var(--base500); } .calendar td.selected { font-weight: 600; - border: 1px solid var(--gray600); + border: 1px solid var(--base600); } .calendar td.selected:hover { @@ -41,18 +41,18 @@ } .calendar td.disabled { - color: var(--gray400); - background: var(--gray75); + color: var(--base400); + background: var(--base75); } .calendar td.disabled:hover { cursor: default; - background: var(--gray75); + background: var(--base75); border-color: transparent; } .calendar td.faded.disabled { - background: var(--gray100); + background: var(--base100); } .header { @@ -61,7 +61,7 @@ align-items: center; font-weight: 700; line-height: 40px; - font-size: var(--font-size-normal); + font-size: var(--font-size-md); } .body { diff --git a/components/common/Checkbox.module.css b/components/common/Checkbox.module.css index c9a01eac..edd2b776 100644 --- a/components/common/Checkbox.module.css +++ b/components/common/Checkbox.module.css @@ -11,7 +11,7 @@ align-items: center; width: 20px; height: 20px; - border: 1px solid var(--gray500); + border: 1px solid var(--base500); border-radius: 4px; } diff --git a/components/common/Dot.module.css b/components/common/Dot.module.css index 258d6e87..284aa66d 100644 --- a/components/common/Dot.module.css +++ b/components/common/Dot.module.css @@ -1,5 +1,5 @@ .wrapper { - background: var(--gray50); + background: var(--base50); margin-right: 10px; border-radius: 100%; } diff --git a/components/common/Dropdown.module.css b/components/common/Dropdown.module.css index 9738b007..a1877529 100644 --- a/components/common/Dropdown.module.css +++ b/components/common/Dropdown.module.css @@ -3,7 +3,7 @@ display: flex; justify-content: space-between; align-items: center; - border: 1px solid var(--gray500); + border: 1px solid var(--base500); border-radius: 4px; cursor: pointer; } @@ -12,7 +12,7 @@ flex: 1; display: flex; justify-content: space-between; - font-size: var(--font-size-small); + font-size: var(--font-size-sm); flex-wrap: nowrap; white-space: nowrap; padding: 4px 16px; diff --git a/components/common/ErrorMessage.module.css b/components/common/ErrorMessage.module.css index 88769cf5..dd9295d9 100644 --- a/components/common/ErrorMessage.module.css +++ b/components/common/ErrorMessage.module.css @@ -6,7 +6,7 @@ margin: auto; display: flex; z-index: 1; - background-color: var(--gray50); + background-color: var(--base50); padding: 10px; } diff --git a/components/common/FilterLink.module.css b/components/common/FilterLink.module.css index 45b049da..ce3ffa5f 100644 --- a/components/common/FilterLink.module.css +++ b/components/common/FilterLink.module.css @@ -4,11 +4,11 @@ } .row .inactive { - color: var(--gray500); + color: var(--base500); } .row .active { - color: var(--gray900); + color: var(--base900); font-weight: 600; } diff --git a/components/common/Link.module.css b/components/common/Link.module.css index dd2f92f9..93deda65 100644 --- a/components/common/Link.module.css +++ b/components/common/Link.module.css @@ -2,7 +2,7 @@ a.link, a.link:active, a.link:visited { position: relative; - color: var(--gray900); + color: var(--base900); text-decoration: none; display: inline-flex; align-items: center; @@ -21,11 +21,11 @@ a.link.large { } a.link.small { - font-size: var(--font-size-small); + font-size: var(--font-size-sm); } a.link.xsmall { - font-size: var(--font-size-xsmall); + font-size: var(--font-size-xs); } a.link .icon + * { diff --git a/components/common/Loading.module.css b/components/common/Loading.module.css index a69559e3..e2d53243 100644 --- a/components/common/Loading.module.css +++ b/components/common/Loading.module.css @@ -25,7 +25,7 @@ height: 100%; width: 100%; z-index: 10; - background: var(--gray400); + background: var(--base400); opacity: 0.4; } @@ -33,13 +33,13 @@ width: 10px; height: 10px; border-radius: 100%; - background: var(--gray400); + background: var(--base400); animation: blink 1.4s infinite; animation-fill-mode: both; } .loading.overlay div { - background: var(--gray900); + background: var(--base900); } .loading div + div { diff --git a/components/common/Menu.module.css b/components/common/Menu.module.css index d2ad2cc4..63491d40 100644 --- a/components/common/Menu.module.css +++ b/components/common/Menu.module.css @@ -1,22 +1,22 @@ .menu { - background: var(--gray50); - border: 1px solid var(--gray500); + background: var(--base50); + border: 1px solid var(--base500); border-radius: 4px; overflow: hidden; z-index: 100; } .option { - font-size: var(--font-size-small); + font-size: var(--font-size-sm); font-weight: normal; - background: var(--gray50); + background: var(--base50); padding: 4px 16px; cursor: pointer; white-space: nowrap; } .option:hover { - background: var(--gray100); + background: var(--base100); } .float { @@ -43,7 +43,7 @@ } .divider { - border-top: 1px solid var(--gray300); + border-top: 1px solid var(--base300); } .selected { diff --git a/components/common/MenuButton.module.css b/components/common/MenuButton.module.css index 7e9dd7e1..a59ae562 100644 --- a/components/common/MenuButton.module.css +++ b/components/common/MenuButton.module.css @@ -10,11 +10,11 @@ } .text { - font-size: var(--font-size-small); + font-size: var(--font-size-sm); } .open, .open:hover { - background: var(--gray50); - border: 1px solid var(--gray500); + background: var(--base50); + border: 1px solid var(--base500); } diff --git a/components/common/MobileMenu.module.css b/components/common/MobileMenu.module.css index 78a440d9..bdf95647 100644 --- a/components/common/MobileMenu.module.css +++ b/components/common/MobileMenu.module.css @@ -8,7 +8,7 @@ z-index: 100; display: flex; flex-direction: column; - background-color: var(--gray50); + background-color: var(--base50); overflow: auto; } diff --git a/components/common/Modal.module.css b/components/common/Modal.module.css index bf2491c7..3bba9273 100644 --- a/components/common/Modal.module.css +++ b/components/common/Modal.module.css @@ -25,12 +25,12 @@ top: 50%; left: 50%; transform: translate(-50%, -50%); - background: var(--gray50); + background: var(--base50); min-width: 400px; min-height: 100px; max-width: 100vw; z-index: 1; - border: 1px solid var(--gray300); + border: 1px solid var(--base300); padding: 30px; border-radius: 4px; } diff --git a/components/common/NavMenu.module.css b/components/common/NavMenu.module.css index 7be73973..e0b01945 100644 --- a/components/common/NavMenu.module.css +++ b/components/common/NavMenu.module.css @@ -1,6 +1,6 @@ .menu { - color: var(--gray800); - border: 1px solid var(--gray500); + color: var(--base800); + border: 1px solid var(--base500); border-radius: 4px; overflow: hidden; z-index: 2; @@ -13,10 +13,10 @@ } .option:hover { - background: var(--gray75); + background: var(--base75); } .selected { - color: var(--gray900); + color: var(--base900); font-weight: 600; } diff --git a/components/common/NoData.module.css b/components/common/NoData.module.css index 518fa488..29e9f8eb 100644 --- a/components/common/NoData.module.css +++ b/components/common/NoData.module.css @@ -1,6 +1,6 @@ .container { - color: var(--gray500); - font-size: var(--font-size-normal); + color: var(--base500); + font-size: var(--font-size-md); position: relative; display: flex; align-items: center; diff --git a/components/common/Table.module.css b/components/common/Table.module.css index f92338f8..ba4facc5 100644 --- a/components/common/Table.module.css +++ b/components/common/Table.module.css @@ -5,16 +5,16 @@ .table label { display: none; - font-size: var(--font-size-xsmall); + font-size: var(--font-size-xs); font-weight: bold; } .header { - border-bottom: 1px solid var(--gray300); + border-bottom: 1px solid var(--base300); } .head { - font-size: var(--font-size-small); + font-size: var(--font-size-sm); font-weight: 600; line-height: 40px; } @@ -26,7 +26,7 @@ } .row { - border-bottom: 1px solid var(--gray300); + border-bottom: 1px solid var(--base300); padding: 10px 0; } diff --git a/components/common/Tag.module.css b/components/common/Tag.module.css index 5e145ea1..95023bbf 100644 --- a/components/common/Tag.module.css +++ b/components/common/Tag.module.css @@ -1,6 +1,6 @@ .tag { padding: 2px 4px; - border: 1px solid var(--gray300); + border: 1px solid var(--base300); border-radius: 4px; margin-right: 10px; } diff --git a/components/common/Toast.module.css b/components/common/Toast.module.css index 58677dcb..18b8b44d 100644 --- a/components/common/Toast.module.css +++ b/components/common/Toast.module.css @@ -17,7 +17,7 @@ } .message { - font-size: var(--font-size-normal); + font-size: var(--font-size-md); } .close { diff --git a/components/common/UpdateNotice.module.css b/components/common/UpdateNotice.module.css index 52bac611..5161ea71 100644 --- a/components/common/UpdateNotice.module.css +++ b/components/common/UpdateNotice.module.css @@ -6,7 +6,7 @@ } .message { - font-size: var(--font-size-small); + font-size: var(--font-size-sm); font-weight: 600; flex: 1; text-align: center; diff --git a/components/forms/DatePickerForm.module.css b/components/forms/DatePickerForm.module.css index 96e2d2ec..92e59bb7 100644 --- a/components/forms/DatePickerForm.module.css +++ b/components/forms/DatePickerForm.module.css @@ -16,7 +16,7 @@ .calendars > div + div { margin-left: 20px; padding-left: 20px; - border-left: 1px solid var(--gray300); + border-left: 1px solid var(--base300); } .filter { diff --git a/components/forms/EventDataForm.module.css b/components/forms/EventDataForm.module.css index 19d76f77..fd0ad290 100644 --- a/components/forms/EventDataForm.module.css +++ b/components/forms/EventDataForm.module.css @@ -3,7 +3,7 @@ } .form { - border-right: 1px solid var(--gray300); + border-right: 1px solid var(--base300); width: 420px; } @@ -12,7 +12,7 @@ } .filters + .filters { - border-top: 1px solid var(--gray300); + border-top: 1px solid var(--base300); min-height: 250px; } diff --git a/components/forms/Form.module.css b/components/forms/Form.module.css index 9dccd9b3..9185da43 100644 --- a/components/forms/Form.module.css +++ b/components/forms/Form.module.css @@ -43,7 +43,7 @@ .error { width: 600px; margin: 0 auto 30px; - background: var(--gray50); + background: var(--base50); padding: 16px; color: var(--red400); border: 1px solid var(--red400); @@ -54,7 +54,7 @@ .success { width: 600px; margin: 60px auto; - background: var(--gray50); + background: var(--base50); padding: 16px; color: var(--green400); border: 1px solid var(--green400); diff --git a/components/layout/Footer.module.css b/components/layout/Footer.module.css index c484d7f5..b86e9724 100644 --- a/components/layout/Footer.module.css +++ b/components/layout/Footer.module.css @@ -2,7 +2,7 @@ display: flex; justify-content: space-between; align-items: center; - font-size: var(--font-size-small); + font-size: var(--font-size-sm); text-align: center; margin: 30px 0; } diff --git a/components/layout/FormLayout.module.css b/components/layout/FormLayout.module.css index 6d787136..48363f65 100644 --- a/components/layout/FormLayout.module.css +++ b/components/layout/FormLayout.module.css @@ -54,7 +54,7 @@ .msg { color: var(--msgColor); background: var(--red400); - font-size: var(--font-size-small); + font-size: var(--font-size-sm); padding: 4px 8px; border-radius: 4px; white-space: nowrap; @@ -78,8 +78,8 @@ margin: 20px 0; padding: 4px 8px; border-radius: 4px; - color: var(--gray50); - background: var(--gray800); + color: var(--base50); + background: var(--base800); } @media only screen and (max-width: 576px) { diff --git a/components/layout/GridLayout.module.css b/components/layout/GridLayout.module.css index 675fce16..ee7947b6 100644 --- a/components/layout/GridLayout.module.css +++ b/components/layout/GridLayout.module.css @@ -9,12 +9,12 @@ } .row { - border-top: 1px solid var(--gray300); + border-top: 1px solid var(--base300); min-height: 430px; } .row > .col { - border-left: 1px solid var(--gray300); + border-left: 1px solid var(--base300); padding: 20px; } @@ -33,7 +33,7 @@ } .row > .col { - border-top: 1px solid var(--gray300); + border-top: 1px solid var(--base300); border-left: 0; padding: 20px 0; } diff --git a/components/layout/Header.module.css b/components/layout/Header.module.css index 8882e9de..3c7d4bc0 100644 --- a/components/layout/Header.module.css +++ b/components/layout/Header.module.css @@ -7,7 +7,7 @@ .title { flex: 1; - font-size: var(--font-size-large); + font-size: var(--font-size-lg); display: flex; align-items: center; line-height: 1.4; @@ -22,7 +22,7 @@ display: flex; justify-content: center; align-items: center; - font-size: var(--font-size-normal); + font-size: var(--font-size-md); font-weight: 600; } diff --git a/components/layout/Layout.js b/components/layout/Layout.js index 0e4b2b61..1a8d4887 100644 --- a/components/layout/Layout.js +++ b/components/layout/Layout.js @@ -1,20 +1,32 @@ +import { Container } from 'react-basics'; import Head from 'next/head'; import Header from 'components/layout/Header'; import Footer from 'components/layout/Footer'; import useLocale from 'hooks/useLocale'; +import { useRouter } from 'next/router'; export default function Layout({ title, children, header = true, footer = true }) { const { dir } = useLocale(); + const { basePath } = useRouter(); return ( - <> + {title ? `${title} | umami` : 'umami'} + + + + + + + + + + {header &&
}
{children}
{footer &&