mirror of
https://github.com/dylanbenzi/yellowbird.git
synced 2026-11-27 01:07:01 +00:00
flexbox update
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
"@nivo/line": "^0.84.0",
|
"@nivo/line": "^0.84.0",
|
||||||
"@nivo/treemap": "^0.84.0",
|
"@nivo/treemap": "^0.84.0",
|
||||||
"@radix-ui/react-slot": "^1.0.2",
|
"@radix-ui/react-slot": "^1.0.2",
|
||||||
|
"@tanstack/react-table": "^8.13.2",
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
"clsx": "^2.1.0",
|
"clsx": "^2.1.0",
|
||||||
"lightweight-charts": "^4.1.3",
|
"lightweight-charts": "^4.1.3",
|
||||||
|
|||||||
Generated
+20
@@ -23,6 +23,9 @@ dependencies:
|
|||||||
'@radix-ui/react-slot':
|
'@radix-ui/react-slot':
|
||||||
specifier: ^1.0.2
|
specifier: ^1.0.2
|
||||||
version: 1.0.2(@types/[email protected])([email protected])
|
version: 1.0.2(@types/[email protected])([email protected])
|
||||||
|
'@tanstack/react-table':
|
||||||
|
specifier: ^8.13.2
|
||||||
|
version: 8.13.2([email protected])([email protected])
|
||||||
class-variance-authority:
|
class-variance-authority:
|
||||||
specifier: ^0.7.0
|
specifier: ^0.7.0
|
||||||
version: 0.7.0
|
version: 0.7.0
|
||||||
@@ -623,6 +626,23 @@ packages:
|
|||||||
tslib: 2.6.2
|
tslib: 2.6.2
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@tanstack/[email protected]([email protected])([email protected]):
|
||||||
|
resolution: {integrity: sha512-b6mR3mYkjRtJ443QZh9sc7CvGTce81J35F/XMr0OoWbx0KIM7TTTdyNP2XKObvkLpYnLpCrYDwI3CZnLezWvpg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
peerDependencies:
|
||||||
|
react: '>=16'
|
||||||
|
react-dom: '>=16'
|
||||||
|
dependencies:
|
||||||
|
'@tanstack/table-core': 8.13.2
|
||||||
|
react: 18.2.0
|
||||||
|
react-dom: 18.2.0([email protected])
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@tanstack/[email protected]:
|
||||||
|
resolution: {integrity: sha512-/2saD1lWBUV6/uNAwrsg2tw58uvMJ07bO2F1IWMxjFRkJiXKQRuc3Oq2aufeobD3873+4oIM/DRySIw7+QsPPw==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@types/[email protected]:
|
/@types/[email protected]:
|
||||||
resolution: {integrity: sha512-tbaFGDmJWHqnenvk3QGSvD3RVwr631BjKRD7Sc7VLRgrdX5mk5hTyoeBL6rXZaeoXzmZwIl1D2HPogEdt1rHBg==}
|
resolution: {integrity: sha512-tbaFGDmJWHqnenvk3QGSvD3RVwr631BjKRD7Sc7VLRgrdX5mk5hTyoeBL6rXZaeoXzmZwIl1D2HPogEdt1rHBg==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|||||||
@@ -689,7 +689,7 @@ export type newsDataType = {
|
|||||||
outletLogo: string;
|
outletLogo: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const newsData = [
|
export const newsData: newsDataType[] = [
|
||||||
{
|
{
|
||||||
"headline": "Tesla reports 0-60 under 1s available in latest Roadster",
|
"headline": "Tesla reports 0-60 under 1s available in latest Roadster",
|
||||||
"subtitle":
|
"subtitle":
|
||||||
|
|||||||
+34
-4
@@ -1,9 +1,39 @@
|
|||||||
import { PortfolioModule } from "@/components/modules/HomepageModules";
|
"use client";
|
||||||
|
|
||||||
export default function Page() {
|
import { ResponsiveTreeMap } from "@nivo/treemap";
|
||||||
|
import { heatmapData as data } from "../MockData/MockData";
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className="flex h-96 w-[500px] rounded-md">
|
||||||
<PortfolioModule />
|
<div className="flex flex-col flex-grow bg-neutral-800 rounded-lg">
|
||||||
|
<div className="flex justify-between px-2 py-2 pb-0">
|
||||||
|
<div className="flex items-center text-lg px-2">Heatmap</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex-grow w-full">
|
||||||
|
<ResponsiveTreeMap
|
||||||
|
data={data}
|
||||||
|
identity="name"
|
||||||
|
value="loc"
|
||||||
|
valueFormat=".02s"
|
||||||
|
tile="binary"
|
||||||
|
// margin={{ top: 10, right: 10, bottom: 10, left: 10 }}
|
||||||
|
labelSkipSize={30}
|
||||||
|
labelTextColor="black"
|
||||||
|
parentLabelPosition="left"
|
||||||
|
parentLabelTextColor={{
|
||||||
|
from: "color",
|
||||||
|
modifiers: [["darker", 2]],
|
||||||
|
}}
|
||||||
|
colors={{ scheme: "red_yellow_green" }}
|
||||||
|
borderColor={{
|
||||||
|
from: "color",
|
||||||
|
modifiers: [["brighter", 0.1]],
|
||||||
|
}}
|
||||||
|
motionConfig="wobbly"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
|
|
||||||
const NewsTable = () => {
|
|
||||||
return <div>NewsTable</div>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default NewsTable;
|
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import {
|
||||||
|
ColumnDef,
|
||||||
|
flexRender,
|
||||||
|
getCoreRowModel,
|
||||||
|
useReactTable,
|
||||||
|
} from "@tanstack/react-table";
|
||||||
|
|
||||||
|
import {
|
||||||
|
Table,
|
||||||
|
TableBody,
|
||||||
|
TableCell,
|
||||||
|
TableHead,
|
||||||
|
TableHeader,
|
||||||
|
TableRow,
|
||||||
|
} from "@/components/ui/table";
|
||||||
|
|
||||||
|
interface NewsTableProps<TData, TValue> {
|
||||||
|
columns: ColumnDef<TData, TValue>[];
|
||||||
|
data: TData[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function NewsTable<TData, TValue>({
|
||||||
|
columns,
|
||||||
|
data,
|
||||||
|
}: NewsTableProps<TData, TValue>) {
|
||||||
|
const table = useReactTable({
|
||||||
|
data,
|
||||||
|
columns,
|
||||||
|
getCoreRowModel: getCoreRowModel(),
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="rounded-md border">
|
||||||
|
<Table>
|
||||||
|
<TableHeader>
|
||||||
|
{table.getHeaderGroups().map((headerGroup) => (
|
||||||
|
<TableRow key={headerGroup.id}>
|
||||||
|
{headerGroup.headers.map((header) => {
|
||||||
|
return (
|
||||||
|
<TableHead key={header.id}>
|
||||||
|
{header.isPlaceholder
|
||||||
|
? null
|
||||||
|
: flexRender(
|
||||||
|
header.column.columnDef.header,
|
||||||
|
header.getContext()
|
||||||
|
)}
|
||||||
|
</TableHead>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</TableRow>
|
||||||
|
))}
|
||||||
|
</TableHeader>
|
||||||
|
<TableBody>
|
||||||
|
{table.getRowModel().rows?.length ? (
|
||||||
|
table.getRowModel().rows.map((row) => (
|
||||||
|
<TableRow
|
||||||
|
key={row.id}
|
||||||
|
data-state={row.getIsSelected() && "selected"}
|
||||||
|
>
|
||||||
|
{row.getVisibleCells().map((cell) => (
|
||||||
|
<TableCell key={cell.id}>
|
||||||
|
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
||||||
|
</TableCell>
|
||||||
|
))}
|
||||||
|
</TableRow>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<TableRow>
|
||||||
|
<TableCell colSpan={columns.length} className="h-24 text-center">
|
||||||
|
No results.
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
)}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { ColumnDef } from "@tanstack/react-table";
|
||||||
|
import { newsDataType } from "@/app/MockData/MockData";
|
||||||
|
|
||||||
|
export const newsColumns: ColumnDef<newsDataType>[] = [
|
||||||
|
{
|
||||||
|
accessorKey: "headline",
|
||||||
|
header: "Headline",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "dateTime",
|
||||||
|
header: "Time",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "outlet",
|
||||||
|
header: "Outlet",
|
||||||
|
},
|
||||||
|
];
|
||||||
@@ -9,11 +9,11 @@ interface HomepageModuleProps {
|
|||||||
|
|
||||||
const HomepageModule = ({ title, children }: HomepageModuleProps) => {
|
const HomepageModule = ({ title, children }: HomepageModuleProps) => {
|
||||||
return (
|
return (
|
||||||
<div className="h-full bg-neutral-800 rounded-lg">
|
<div className="flex flex-col h-full bg-neutral-800 rounded-lg">
|
||||||
<div className="flex justify-between px-2 py-2 pb-0">
|
<div className="flex justify-between px-2 py-2 pb-0">
|
||||||
<div className="flex items-center text-lg px-2">{title}</div>
|
<div className="flex items-center text-lg px-2">{title}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="h-3/4 w-full">{children}</div>
|
<div className="flex-grow w-full overflow-hidden">{children}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { heatmapData, portfolioData } from "@/app/MockData/MockData";
|
import { heatmapData, newsData, portfolioData } from "@/app/MockData/MockData";
|
||||||
import HomepageModule from "./HomepageModuleCard";
|
import HomepageModule from "./HomepageModuleCard";
|
||||||
import PortfolioChart from "../charts/PortfolioChart";
|
import PortfolioChart from "../charts/PortfolioChart";
|
||||||
import MarketHeatmap from "../charts/MarketHeatmap";
|
import MarketHeatmap from "../charts/MarketHeatmap";
|
||||||
import { Button } from "../ui/button";
|
import { Button } from "../ui/button";
|
||||||
import { ArrowRight } from "lucide-react";
|
import { ArrowRight } from "lucide-react";
|
||||||
|
import { NewsTable } from "../charts/news/NewsTable";
|
||||||
|
import { newsColumns } from "../charts/news/newsColumns";
|
||||||
|
|
||||||
export const PortfolioModule = () => {
|
export const PortfolioModule = () => {
|
||||||
return (
|
return (
|
||||||
@@ -25,7 +27,11 @@ export const PortfolioModule = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const NewsModule = () => {
|
export const NewsModule = () => {
|
||||||
return <HomepageModule title="News"></HomepageModule>;
|
return (
|
||||||
|
<HomepageModule title="News">
|
||||||
|
<NewsTable columns={newsColumns} data={newsData} />
|
||||||
|
</HomepageModule>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const HeatmapModule = () => {
|
export const HeatmapModule = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user