Skip to content

Commit

Permalink
Merge pull request yihong0618#440 from yihong0618/dev-remove-tags
Browse files Browse the repository at this point in the history
chore: use <></> & remove unnecessary tags & clear float
  • Loading branch information
yihong0618 authored Jul 3, 2023
2 parents dddde0a + ef5cc24 commit 770abf6
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 57 deletions.
4 changes: 2 additions & 2 deletions src/components/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Header = () => {
const { logo, siteUrl, navLinks } = useSiteMetadata();

return (
<div>
<>
<nav
className="db flex justify-between w-100 ph5-l"
style={{ marginTop: '3rem' }}
Expand All @@ -30,7 +30,7 @@ const Header = () => {
))}
</div>
</nav>
</div>
</>
);
};

Expand Down
6 changes: 3 additions & 3 deletions src/components/Layout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Layout = ({ children }) => {
const { siteTitle, description } = useSiteMetadata();

return (
<div>
<>
<Helmet bodyAttributes={{ class: styles.body }}>
<html lang="en" />
<title>{siteTitle}</title>
Expand All @@ -22,8 +22,8 @@ const Layout = ({ children }) => {
/>
</Helmet>
<Header />
<div className="pa3 pa5-l">{children}</div>
</div>
<div className="pa3 pa5-l mb5 cf">{children}</div>
</>
);
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/LocationStat/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import LocationSummary from './LocationSummary';
import PeriodStat from './PeriodStat';

const LocationStat = ({ changeYear, changeCity, changeTitle }) => (
<div className="fl w-100 w-100-l pb5 pr5-l">
<div className="w-100 w-100-l pb5 pr5-l">
<section className="pb4" style={{ paddingBottom: '0rem' }}>
<p style={{ lineHeight: 1.8 }}>
{CHINESE_LOCATION_INFO_MESSAGE_FIRST}
Expand Down
4 changes: 2 additions & 2 deletions src/components/RunMap/RunMaker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import styles from './style.module.scss';
const RunMarker = ({ startLon, startLat, endLon, endLat }) => {
const size = 20;
return (
<div>
<>
<Marker key="maker_start" longitude={startLon} latitude={startLat}>
<div
style={{
Expand All @@ -28,7 +28,7 @@ const RunMarker = ({ startLon, startLat, endLon, endLat }) => {
<EndSvg className={styles.locationSVG} />
</div>
</Marker>
</div>
</>
);
};

Expand Down
28 changes: 13 additions & 15 deletions src/components/RunMap/RunMapButtons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,19 @@ const RunMapButtons = ({ changeYear, thisYear }) => {
yearsButtons.push('Total');

return (
<div>
<ul className={styles.buttons}>
{yearsButtons.map((year) => (
<li
key={`${year}button`}
className={styles.button + ` ${year === thisYear ? styles.selected : ''}`}
onClick={() => {
changeYear(year);
}}
>
{year}
</li>
))}
</ul>
</div>
<ul className={styles.buttons}>
{yearsButtons.map((year) => (
<li
key={`${year}button`}
className={styles.button + ` ${year === thisYear ? styles.selected : ''}`}
onClick={() => {
changeYear(year);
}}
>
{year}
</li>
))}
</ul>
);
};

Expand Down
66 changes: 32 additions & 34 deletions src/pages/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,42 +142,40 @@ const Index = () => {

return (
<Layout>
<div className="mb5">
<div className="fl w-30-l">
<h1 className="f1 fw9 i">
<a href="/">{siteTitle}</a>
</h1>
{viewport.zoom <= 3 && IS_CHINESE ? (
<LocationStat
changeYear={changeYear}
changeCity={changeCity}
changeTitle={changeTitle}
/>
) : (
<YearsStat year={year} onClick={changeYear} />
)}
</div>
<div className="fl w-100 w-70-l">
<RunMap
title={title}
viewport={viewport}
geoData={geoData}
setViewport={setViewport}
<div className="fl w-30-l">
<h1 className="f1 fw9 i">
<a href="/">{siteTitle}</a>
</h1>
{viewport.zoom <= 3 && IS_CHINESE ? (
<LocationStat
changeYear={changeYear}
thisYear={year}
changeCity={changeCity}
changeTitle={changeTitle}
/>
{year === 'Total' ? (
<SVGStat />
) : (
<RunTable
runs={runs}
locateActivity={locateActivity}
setActivity={setActivity}
runIndex={runIndex}
setRunIndex={setRunIndex}
/>
)}
</div>
) : (
<YearsStat year={year} onClick={changeYear} />
)}
</div>
<div className="fl w-100 w-70-l">
<RunMap
title={title}
viewport={viewport}
geoData={geoData}
setViewport={setViewport}
changeYear={changeYear}
thisYear={year}
/>
{year === 'Total' ? (
<SVGStat />
) : (
<RunTable
runs={runs}
locateActivity={locateActivity}
setActivity={setActivity}
runIndex={runIndex}
setRunIndex={setRunIndex}
/>
)}
</div>
{/* Enable Audiences in Vercel Analytics: https://vercel.com/docs/concepts/analytics/audiences/quickstart */}
<Analytics />
Expand Down

0 comments on commit 770abf6

Please sign in to comment.