diff --git a/assets/plus.svg b/assets/plus.svg new file mode 100644 index 00000000..e4774d87 --- /dev/null +++ b/assets/plus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/trash.svg b/assets/trash.svg new file mode 100644 index 00000000..2f525c8f --- /dev/null +++ b/assets/trash.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/Button.js b/components/Button.js index 3fa61800..3900dc3d 100644 --- a/components/Button.js +++ b/components/Button.js @@ -3,10 +3,24 @@ import classNames from 'classnames'; import Icon from './Icon'; import styles from './Button.module.css'; -export default function Button({ icon, type = 'button', children, className, onClick = () => {} }) { +export default function Button({ + type = 'button', + icon, + size, + children, + className, + onClick = () => {}, +}) { return ( - ); diff --git a/components/Button.module.css b/components/Button.module.css index a03d3f8f..fc46c02d 100644 --- a/components/Button.module.css +++ b/components/Button.module.css @@ -14,3 +14,15 @@ .button:hover { background: #eaeaea; } + +.button + .button { + margin-left: 10px; +} + +.small { + font-size: var(--font-size-small); +} + +.large { + font-size: var(--font-size-large); +} diff --git a/components/FormLayout.js b/components/FormLayout.js index 66c0fb15..28c5f2d5 100644 --- a/components/FormLayout.js +++ b/components/FormLayout.js @@ -17,4 +17,5 @@ export const FormError = ({ name }) => ( export const FormRow = ({ children }) =>
{children}
; -export const FormMessage = ({ children }) =>
{children}
; +export const FormMessage = ({ children }) => + children ?
{children}
: null; diff --git a/components/Icon.module.css b/components/Icon.module.css index 23cb16bd..e234799f 100644 --- a/components/Icon.module.css +++ b/components/Icon.module.css @@ -5,6 +5,10 @@ vertical-align: middle; } +.icon + * { + margin-left: 10px; +} + .icon svg { fill: currentColor; } diff --git a/components/Login.js b/components/Login.js index 1daff572..d2da76d8 100644 --- a/components/Login.js +++ b/components/Login.js @@ -56,7 +56,9 @@ export default function Login() { - + {message} diff --git a/components/Login.module.css b/components/Login.module.css index 43bc3150..572dcb15 100644 --- a/components/Login.module.css +++ b/components/Login.module.css @@ -2,3 +2,12 @@ font-size: var(--font-size-xlarge); text-align: center; } + +.button { + color: var(--gray50); + background: var(--gray900); +} + +.button:hover { + background: var(--gray800); +} diff --git a/components/PageHeader.js b/components/PageHeader.js new file mode 100644 index 00000000..9e4d8b61 --- /dev/null +++ b/components/PageHeader.js @@ -0,0 +1,12 @@ +import React, { Children } from 'react'; +import styles from './PageHeader.module.css'; + +export default function PageHeader({ children }) { + const [firstChild, ...otherChildren] = Children.toArray(children); + return ( +
+
{firstChild}
+ {otherChildren &&
{otherChildren}
} +
+ ); +} diff --git a/components/PageHeader.module.css b/components/PageHeader.module.css new file mode 100644 index 00000000..fc93b049 --- /dev/null +++ b/components/PageHeader.module.css @@ -0,0 +1,10 @@ +.header { + display: flex; + justify-content: space-between; + align-items: center; + line-height: 80px; +} + +.title { + font-size: var(--font-size-large); +} diff --git a/components/Settings.js b/components/Settings.js index 60b7196a..23e218b5 100644 --- a/components/Settings.js +++ b/components/Settings.js @@ -1,16 +1,37 @@ import React, { useState, useEffect } from 'react'; import Page from './Page'; import Table from './Table'; +import Button from './Button'; +import Icon from './Icon'; +import PageHeader from './PageHeader'; +import Pen from 'assets/pen.svg'; +import Trash from 'assets/trash.svg'; +import Plus from 'assets/plus.svg'; import { get } from 'lib/web'; -const columns = [ - { key: 'name', label: 'Name' }, - { key: 'domain', label: 'Domain' }, -]; - export default function Settings() { const [data, setData] = useState(); + const columns = [ + { key: 'name', label: 'Name' }, + { key: 'domain', label: 'Domain' }, + { + key: 'action', + label: '', + style: { flex: 0 }, + render: ({ website_id }) => ( + <> + + + + ), + }, + ]; + async function loadData() { setData(await get(`/api/website`)); } @@ -25,7 +46,13 @@ export default function Settings() { return ( -

Settings

+ +
Settings
+ +
); diff --git a/components/Table.js b/components/Table.js index a957ee7a..a910f5d1 100644 --- a/components/Table.js +++ b/components/Table.js @@ -1,25 +1,32 @@ import React from 'react'; +import classNames from 'classnames'; import styles from './Table.module.css'; export default function Table({ columns, rows }) { return ( -
- - - {columns.map(({ key, label }) => ( - - ))} - - - - {rows.map((row, rowIndex) => ( - - {columns.map(({ key }) => ( - - ))} - +
+
+ {columns.map(({ key, label }) => ( +
+ {label} +
))} -
-
{label}
{row[key]}
+ +
+ {rows.map((row, rowIndex) => ( +
+ {columns.map(({ key, render, className, style }) => ( +
+ {render ? render(row) : row[key]} +
+ ))} +
+ ))} +
+ ); } diff --git a/components/Table.module.css b/components/Table.module.css index ce2ba655..75b44feb 100644 --- a/components/Table.module.css +++ b/components/Table.module.css @@ -1,7 +1,27 @@ .table { - width: 100%; + display: flex; + flex-direction: column; } -.table th { - text-align: left; +.header { + display: flex; +} + +.head { + font-size: var(--font-size-small); + font-weight: 600; + line-height: 40px; + flex: 1; +} + +.row { + display: flex; + border-bottom: 1px solid var(--gray300); + padding: 10px 0; +} + +.cell { + display: flex; + align-items: flex-start; + flex: 1; } diff --git a/components/WebsiteDetails.js b/components/WebsiteDetails.js index 1f120057..96ed4c74 100644 --- a/components/WebsiteDetails.js +++ b/components/WebsiteDetails.js @@ -8,6 +8,7 @@ import { getDateRange } from 'lib/date'; import { get } from 'lib/web'; import { browserFilter, urlFilter, refFilter, deviceFilter, countryFilter } from 'lib/filters'; import styles from './WebsiteDetails.module.css'; +import PageHeader from './PageHeader'; const pageviewClasses = 'col-md-12 col-lg-6'; const sessionClasses = 'col-12 col-lg-4'; @@ -45,7 +46,7 @@ export default function WebsiteDetails({ websiteId, defaultDateRange = '7day' })
-

{data.name}

+ {data.name} (
-
-

- - {name} - -

+ - } /> View details + {name} -
+ +
))} diff --git a/components/WebsiteList.module.css b/components/WebsiteList.module.css index 2b3f2618..b6c4acca 100644 --- a/components/WebsiteList.module.css +++ b/components/WebsiteList.module.css @@ -9,21 +9,6 @@ margin-bottom: 0; } -.header { - display: flex; - justify-content: space-between; - align-items: center; -} - -.title { - color: var(--gray900) !important; -} - -.details { - font-size: 14px; - font-weight: 600; -} - -.details svg { - margin-right: 5px; +.button { + font-size: var(--font-size-small); }