Browse Source

misc

Signed-off-by: Muthu Kumar <muthukumar@thefeathers.in>
pull/1/head
Muthu Kumar 3 years ago
parent
commit
e071805f11
Signed by: mkrhere GPG Key ID: 3FD688398897097E
  1. 8
      src/components/Timeline.tsx
  2. 3
      vite.config.ts

8
src/components/Timeline.tsx

@ -2,8 +2,8 @@ import React, { useMemo } from "react";
import { css, cx } from "@emotion/css"; import { css, cx } from "@emotion/css";
import { format, isBefore, startOfDay } from "date-fns"; import { format, isBefore, startOfDay } from "date-fns";
type TLUnit = { title?: string; url?: string; img?: string; date: string }; export type TimelineUnit = { title?: string; url?: string; img?: string; date: string };
type TimelineUnits = TLUnit[]; export type TimelineUnits = TimelineUnit[];
const unit = css` const unit = css`
display: flex; display: flex;
@ -86,7 +86,7 @@ const tlcontainer = css`
} }
`; `;
const TimelineUnit: React.FunctionComponent<{ contents: TLUnit }> = ({ contents }) => { const Unit: React.FunctionComponent<{ contents: TimelineUnit }> = ({ contents }) => {
const date = useMemo(() => new Date(contents.date), [contents.date]); const date = useMemo(() => new Date(contents.date), [contents.date]);
return ( return (
@ -125,7 +125,7 @@ const Timeline: React.FunctionComponent<{ contents: TimelineUnits }> = ({ conten
.map(unit => ({ ...unit, Date: new Date(unit.date) })) .map(unit => ({ ...unit, Date: new Date(unit.date) }))
.filter(unit => !isBefore(startOfDay(unit.Date), current)) .filter(unit => !isBefore(startOfDay(unit.Date), current))
.map(unit => ( .map(unit => (
<TimelineUnit key={unit.date} contents={unit} /> <Unit key={unit.date} contents={unit} />
))} ))}
</div> </div>
); );

3
vite.config.ts

@ -6,9 +6,6 @@ import svgr from "@svgr/rollup";
export default defineConfig({ export default defineConfig({
server: { server: {
port: 12000, port: 12000,
hmr: {
port: 12000,
},
}, },
plugins: [ plugins: [
reactRefresh(), reactRefresh(),

Loading…
Cancel
Save