Mobile layout updates.

This commit is contained in:
Mike Cao 2022-03-01 19:28:44 -08:00
parent 98b2ee29ef
commit 0b846b482d
17 changed files with 99 additions and 46 deletions

View File

@ -8,14 +8,12 @@ a.link:visited {
align-items: center; align-items: center;
} }
a.link:hover:before { a.link span {
content: ''; border-bottom: 2px solid transparent;
position: absolute; }
bottom: -2px;
width: 100%; a.link:hover span {
height: 2px; border-bottom: 2px solid var(--primary400);
background: var(--primary400);
opacity: 0.5;
} }
a.link.large { a.link.large {

View File

@ -28,6 +28,10 @@
margin-top: 20px; margin-top: 20px;
} }
.item:last-child {
margin-top: 60px;
}
.button { .button {
margin-right: 15px; margin-right: 15px;
} }

View File

@ -76,12 +76,13 @@ export default Table;
export const TableRow = ({ columns, row }) => ( export const TableRow = ({ columns, row }) => (
<div className={classNames(styles.row, 'row')}> <div className={classNames(styles.row, 'row')}>
{columns.map(({ key, render, className, style, cell }, index) => ( {columns.map(({ key, label, render, className, style, cell }, index) => (
<div <div
key={`${key}-${index}`} key={`${key}-${index}`}
className={classNames(styles.cell, className, cell?.className)} className={classNames(styles.cell, className, cell?.className)}
style={{ ...style, ...cell?.style }} style={{ ...style, ...cell?.style }}
> >
{label && <label>{label}</label>}
{render ? render(row) : row[key]} {render ? render(row) : row[key]}
</div> </div>
))} ))}

View File

@ -3,6 +3,12 @@
flex-direction: column; flex-direction: column;
} }
.table label {
display: none;
font-size: var(--font-size-xsmall);
font-weight: bold;
}
.header { .header {
border-bottom: 1px solid var(--gray300); border-bottom: 1px solid var(--gray300);
} }
@ -26,5 +32,24 @@
.cell { .cell {
display: flex; display: flex;
flex-direction: column;
align-items: flex-start; align-items: flex-start;
} }
@media only screen and (max-width: 992px) {
.table label {
display: block;
}
.header {
display: none;
}
.row {
flex-direction: column;
}
.cell {
margin-bottom: 20px;
}
}

View File

@ -1,6 +1,7 @@
.buttons { .buttons {
display: flex; display: flex;
align-items: center; align-items: center;
width: 100%;
} }
.buttons button + * { .buttons button + * {

View File

@ -7,7 +7,7 @@ import { dateFormat } from 'lib/date';
import useLocale from 'hooks/useLocale'; import useLocale from 'hooks/useLocale';
import useTheme from 'hooks/useTheme'; import useTheme from 'hooks/useTheme';
import useForceUpdate from 'hooks/useForceUpdate'; import useForceUpdate from 'hooks/useForceUpdate';
import { DEFAUL_CHART_HEIGHT, DEFAULT_ANIMATION_DURATION, THEME_COLORS } from 'lib/constants'; import { DEFAULT_ANIMATION_DURATION, THEME_COLORS } from 'lib/constants';
import styles from './BarChart.module.css'; import styles from './BarChart.module.css';
import ChartTooltip from './ChartTooltip'; import ChartTooltip from './ChartTooltip';
@ -16,7 +16,6 @@ export default function BarChart({
datasets, datasets,
unit, unit,
records, records,
height = DEFAUL_CHART_HEIGHT,
animationDuration = DEFAULT_ANIMATION_DURATION, animationDuration = DEFAULT_ANIMATION_DURATION,
className, className,
stacked = false, stacked = false,
@ -215,7 +214,6 @@ export default function BarChart({
data-tip="" data-tip=""
data-for={`${chartId}-tooltip`} data-for={`${chartId}-tooltip`}
className={classNames(styles.chart, className)} className={classNames(styles.chart, className)}
style={{ height }}
> >
<canvas ref={canvas} /> <canvas ref={canvas} />
</div> </div>

View File

@ -1,3 +1,10 @@
.chart { .chart {
position: relative; position: relative;
height: 400px;
}
@media only screen and (max-width: 992px) {
.chart {
height: 200px;
}
} }

View File

@ -95,3 +95,9 @@
background: var(--primary400); background: var(--primary400);
z-index: -1; z-index: -1;
} }
@media only screen and (max-width: 992px) {
.body {
height: auto;
}
}

View File

@ -96,7 +96,6 @@ export default function RealtimeViews({ websiteId, data, websites }) {
title={<FormattedMessage id="metrics.referrers" defaultMessage="Referrers" />} title={<FormattedMessage id="metrics.referrers" defaultMessage="Referrers" />}
metric={<FormattedMessage id="metrics.views" defaultMessage="Views" />} metric={<FormattedMessage id="metrics.views" defaultMessage="Views" />}
data={referrers} data={referrers}
height={400}
/> />
)} )}
{filter === FILTER_PAGES && ( {filter === FILTER_PAGES && (
@ -105,7 +104,6 @@ export default function RealtimeViews({ websiteId, data, websites }) {
metric={<FormattedMessage id="metrics.views" defaultMessage="Views" />} metric={<FormattedMessage id="metrics.views" defaultMessage="Views" />}
renderLabel={renderLink} renderLabel={renderLink}
data={pages} data={pages}
height={400}
/> />
)} )}
</> </>

View File

@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import classNames from 'classnames';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import Link from 'components/common/Link'; import Link from 'components/common/Link';
import OverflowText from 'components/common/OverflowText'; import OverflowText from 'components/common/OverflowText';
@ -30,9 +31,12 @@ export default function WebsiteHeader({ websiteId, title, domain, showLink = fal
); );
return ( return (
<PageHeader> <PageHeader className="row">
<div className={styles.title}>{header}</div> <div className={classNames(styles.title, 'col-12 col-lg-4')}>{header}</div>
<ActiveUsers className={styles.active} websiteId={websiteId} /> <div className={classNames(styles.active, 'col-6 col-lg-4')}>
<ActiveUsers websiteId={websiteId} />
</div>
<div className="col-6 col-lg-4">
<ButtonLayout align="right"> <ButtonLayout align="right">
<RefreshButton websiteId={websiteId} /> <RefreshButton websiteId={websiteId} />
{showLink && ( {showLink && (
@ -48,6 +52,7 @@ export default function WebsiteHeader({ websiteId, title, domain, showLink = fal
</Link> </Link>
)} )}
</ButtonLayout> </ButtonLayout>
</div>
</PageHeader> </PageHeader>
); );
} }

View File

@ -16,8 +16,12 @@
font-weight: 600; font-weight: 600;
} }
@media only screen and (max-width: 576px) {
.active { .active {
display: none; justify-content: center;
}
@media only screen and (max-width: 992px) {
.active {
justify-content: flex-start;
} }
} }

View File

@ -145,7 +145,6 @@ export default function RealtimeDashboard() {
metric={<FormattedMessage id="metrics.visitors" defaultMessage="Visitors" />} metric={<FormattedMessage id="metrics.visitors" defaultMessage="Visitors" />}
data={countries} data={countries}
renderLabel={renderCountryName} renderLabel={renderCountryName}
height={500}
/> />
</GridColumn> </GridColumn>
<GridColumn xs={12} lg={8}> <GridColumn xs={12} lg={8}>

View File

@ -68,7 +68,7 @@ export default function TestConsole() {
{show && ( {show && (
<div className={classNames(styles.test, 'row')}> <div className={classNames(styles.test, 'row')}>
<div className="col-4"> <div className="col-4">
<PageHeader>Page links</PageHeader> <PageHeader>Page links</PageHeader>Nmo
<div> <div>
<Link href={`?page=1`}> <Link href={`?page=1`}>
<a>page one</a> <a>page one</a>
@ -79,6 +79,11 @@ export default function TestConsole() {
<a>page two</a> <a>page two</a>
</Link> </Link>
</div> </div>
<div>
<Link href={`https://www.google.com`}>
<a className="umami--click--external-link">external link</a>
</Link>
</div>
</div> </div>
<div className="col-4"> <div className="col-4">
<PageHeader>CSS events</PageHeader> <PageHeader>CSS events</PageHeader>

View File

@ -53,23 +53,23 @@ export default function AccountSettings() {
{ {
key: 'username', key: 'username',
label: <FormattedMessage id="label.username" defaultMessage="Username" />, label: <FormattedMessage id="label.username" defaultMessage="Username" />,
className: 'col-4 col-md-3', className: 'col-12 col-lg-4',
}, },
{ {
key: 'is_admin', key: 'is_admin',
label: <FormattedMessage id="label.administrator" defaultMessage="Administrator" />, label: <FormattedMessage id="label.administrator" defaultMessage="Administrator" />,
className: 'col-4 col-md-3', className: 'col-12 col-lg-3',
render: Checkmark, render: Checkmark,
}, },
{ {
key: 'dashboard', key: 'dashboard',
label: <FormattedMessage id="label.dashboard" defaultMessage="Dashboard" />, label: <FormattedMessage id="label.dashboard" defaultMessage="Dashboard" />,
className: 'col-4 col-md-3', className: 'col-12 col-lg-3',
render: DashboardLink, render: DashboardLink,
}, },
{ {
key: 'actions', key: 'actions',
className: classNames(styles.buttons, 'col-12 col-md-3 pt-2 pt-md-0'), className: classNames(styles.buttons, 'col-12 col-lg-2 pt-2 pt-md-0'),
render: Buttons, render: Buttons,
}, },
]; ];

View File

@ -7,5 +7,5 @@
} }
.active { .active {
border: 1px solid var(--gray500); border: 1px solid var(--primary400);
} }

View File

@ -101,19 +101,19 @@ export default function WebsiteSettings() {
{ {
key: 'name', key: 'name',
label: <FormattedMessage id="label.name" defaultMessage="Name" />, label: <FormattedMessage id="label.name" defaultMessage="Name" />,
className: 'col-4 col-xl-3', className: 'col-12 col-lg-4 col-xl-3',
render: DetailsLink, render: DetailsLink,
}, },
{ {
key: 'domain', key: 'domain',
label: <FormattedMessage id="label.domain" defaultMessage="Domain" />, label: <FormattedMessage id="label.domain" defaultMessage="Domain" />,
className: 'col-4 col-xl-3', className: 'col-12 col-lg-4 col-xl-3',
render: Domain, render: Domain,
}, },
{ {
key: 'account', key: 'account',
label: <FormattedMessage id="label.owner" defaultMessage="Owner" />, label: <FormattedMessage id="label.owner" defaultMessage="Owner" />,
className: 'col-4 col-xl-1', className: 'col-12 col-lg-4 col-xl-1',
}, },
{ {
key: 'action', key: 'action',
@ -126,13 +126,13 @@ export default function WebsiteSettings() {
{ {
key: 'name', key: 'name',
label: <FormattedMessage id="label.name" defaultMessage="Name" />, label: <FormattedMessage id="label.name" defaultMessage="Name" />,
className: 'col-6 col-xl-4', className: 'col-12 col-lg-6 col-xl-4',
render: DetailsLink, render: DetailsLink,
}, },
{ {
key: 'domain', key: 'domain',
label: <FormattedMessage id="label.domain" defaultMessage="Domain" />, label: <FormattedMessage id="label.domain" defaultMessage="Domain" />,
className: 'col-6 col-xl-4', className: 'col-12 col-lg-6 col-xl-4',
render: Domain, render: Domain,
}, },
{ {

View File

@ -3,7 +3,9 @@
} }
.buttons { .buttons {
display: flex;
justify-content: flex-end; justify-content: flex-end;
width: 100%;
} }
.detailLink { .detailLink {