New components, convert hooks to components, bug fixes.

This commit is contained in:
Mike Cao 2020-08-03 23:20:35 -07:00
parent a2db27894f
commit 9d8a2406e1
21 changed files with 330 additions and 181 deletions

View file

@ -1,7 +1,9 @@
import React, { useState, useEffect } from 'react';
import Link from 'next/link';
import { get } from 'lib/web';
import Link from './Link';
import WebsiteChart from './WebsiteChart';
import Icon from './Icon';
import { get } from 'lib/web';
import Arrow from 'assets/arrow-right.svg';
import styles from './WebsiteList.module.css';
export default function WebsiteList() {
@ -16,18 +18,23 @@ export default function WebsiteList() {
}, []);
return (
<div className={styles.container}>
<>
{data &&
data.websites.map(({ website_id, label }) => (
<div key={website_id}>
<h2>
<Link href={`/website/${website_id}/${label}`}>
<a>{label}</a>
<div key={website_id} className={styles.website}>
<div className={styles.header}>
<h2>
<Link href={`/website/${website_id}/${label}`} className={styles.title}>
{label}
</Link>
</h2>
<Link href={`/website/${website_id}/${label}`} className={styles.details}>
<Icon icon={<Arrow />} /> View details
</Link>
</h2>
</div>
<WebsiteChart key={website_id} title={label} websiteId={website_id} />
</div>
))}
</div>
</>
);
}