mirror of
https://github.com/dylanbenzi/yellowbird.git
synced 2026-11-27 01:07:01 +00:00
flexbox update
This commit is contained in:
@@ -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) => {
|
||||
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 items-center text-lg px-2">{title}</div>
|
||||
</div>
|
||||
<div className="h-3/4 w-full">{children}</div>
|
||||
<div className="flex-grow w-full overflow-hidden">{children}</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 PortfolioChart from "../charts/PortfolioChart";
|
||||
import MarketHeatmap from "../charts/MarketHeatmap";
|
||||
import { Button } from "../ui/button";
|
||||
import { ArrowRight } from "lucide-react";
|
||||
import { NewsTable } from "../charts/news/NewsTable";
|
||||
import { newsColumns } from "../charts/news/newsColumns";
|
||||
|
||||
export const PortfolioModule = () => {
|
||||
return (
|
||||
@@ -25,7 +27,11 @@ export const PortfolioModule = () => {
|
||||
};
|
||||
|
||||
export const NewsModule = () => {
|
||||
return <HomepageModule title="News"></HomepageModule>;
|
||||
return (
|
||||
<HomepageModule title="News">
|
||||
<NewsTable columns={newsColumns} data={newsData} />
|
||||
</HomepageModule>
|
||||
);
|
||||
};
|
||||
|
||||
export const HeatmapModule = () => {
|
||||
|
||||
Reference in New Issue
Block a user