Skip to content

Commit

Permalink
Fix chart layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Ru Chern Chong committed Nov 3, 2023
1 parent 7e807eb commit 3545b57
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 15 deletions.
8 changes: 7 additions & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import type { Metadata } from "next";
import Script from "next/script";
import { Inter } from "next/font/google";
import classNames from "classnames";
import "./globals.css";

const inter = Inter({ subsets: ["latin"] });
Expand Down Expand Up @@ -29,7 +30,12 @@ const RootLayout = ({ children }: { children: React.ReactNode }) => {
gtag('config', '${gaMeasurementId}');
`}
</Script>
<body className={inter.className}>
<body
className={classNames(
inter.className,
"bg-neutral-50 text-neutral-900 dark:bg-neutral-900 dark:text-neutral-50",
)}
>
<main className="mx-auto w-full max-w-6xl px-4 py-8">{children}</main>
</body>
</html>
Expand Down
10 changes: 7 additions & 3 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ const Home = async () => {
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
/>
<div className="flex flex-col items-center">
<h1>Singapore EV Trends</h1>
<div className="h-screen w-full">
<div className="flex flex-col items-center gap-8">
<div className="prose dark:prose-invert">
<h1>
Singapore <br className="md:hidden" /> EV Trends
</h1>
</div>
<div className="aspect-video w-full">
<LineChart data={data} options={options} />
</div>
</div>
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion components/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ type LineChartProps = {
};

export const LineChart = ({ data, options }: LineChartProps) => {
return <Line data={data} options={options} />;
return <Line data={data} options={options} className="bg-neutral-50 p-4" />;
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
},
"dependencies": {
"chart.js": "^4.4.0",
"classnames": "^2.3.2",
"d3": "^7.8.5",
"next": "14.0.0",
"react": "^18",
Expand All @@ -23,6 +24,7 @@
"@babel/core": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/preset-typescript": "^7.23.2",
"@tailwindcss/typography": "^0.5.10",
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "^14.0.0",
"@types/d3": "^7.4.2",
Expand Down
20 changes: 10 additions & 10 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import type { Config } from 'tailwindcss'
import type { Config } from "tailwindcss";

const config: Config = {
content: [
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
'gradient-conic':
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
"gradient-conic":
"conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
},
},
},
plugins: [],
}
export default config
plugins: [require("@tailwindcss/typography")],
};
export default config;

0 comments on commit 3545b57

Please sign in to comment.