Skip to content

Commit cc24404

Browse files
authored
Update to Tremor v2 (vercel#8)
* update tremor version * run prettier * bump tremor version
1 parent af0ce21 commit cc24404

File tree

7 files changed

+90
-75
lines changed

7 files changed

+90
-75
lines changed

app/layout.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import './globals.css';
2-
import '@tremor/react/dist/esm/tremor.css';
32

43
import Nav from './nav';
54
import AnalyticsWrapper from './analytics';

app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default async function IndexPage({
2424
A list of users retrieved from a MySQL database (PlanetScale).
2525
</Text>
2626
<Search />
27-
<Card marginTop="mt-6">
27+
<Card className="mt-6">
2828
{/* @ts-expect-error Server Component */}
2929
<UsersTable users={users} />
3030
</Card>

app/playground/chart.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,35 @@ const data = [
66
{
77
Month: 'Jan 21',
88
Sales: 2890,
9-
Profit: 2400,
9+
Profit: 2400
1010
},
1111
{
1212
Month: 'Feb 21',
1313
Sales: 1890,
14-
Profit: 1398,
14+
Profit: 1398
1515
},
1616
{
1717
Month: 'Jan 22',
1818
Sales: 3890,
19-
Profit: 2980,
20-
},
19+
Profit: 2980
20+
}
2121
];
2222

2323
const valueFormatter = (number: number) =>
2424
`$ ${Intl.NumberFormat('us').format(number).toString()}`;
2525

2626
export default function Chart() {
2727
return (
28-
<Card marginTop="mt-8">
28+
<Card className="mt-8">
2929
<Title>Performance</Title>
3030
<Text>Comparison between Sales and Profit</Text>
3131
<AreaChart
32-
marginTop="mt-4"
32+
className="mt-4 h-80"
3333
data={data}
3434
categories={['Sales', 'Profit']}
35-
dataKey="Month"
35+
index="Month"
3636
colors={['indigo', 'fuchsia']}
3737
valueFormatter={valueFormatter}
38-
height="h-80"
3938
/>
4039
</Card>
4140
);

app/playground/page.tsx

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
import {
2-
Card,
3-
Metric,
4-
Text,
5-
Flex,
6-
ColGrid,
7-
Title,
8-
BarList
9-
} from '@tremor/react';
1+
import { Card, Metric, Text, Flex, Grid, Title, BarList } from '@tremor/react';
102
import Chart from './chart';
113

124
const website = [
@@ -78,54 +70,47 @@ const categories: {
7870
export default function PlaygroundPage() {
7971
return (
8072
<main className="p-4 md:p-10 mx-auto max-w-7xl">
81-
<ColGrid numColsSm={2} numColsLg={3} gapX="gap-x-6" gapY="gap-y-6">
73+
<Grid className="gap-6" numColsSm={2} numColsLg={3}>
8274
{categories.map((item) => (
8375
<Card key={item.title}>
84-
<Flex alignItems="items-start">
76+
<Flex alignItems="start">
8577
<Text>{item.title}</Text>
8678
</Flex>
8779
<Flex
88-
justifyContent="justify-start"
89-
alignItems="items-baseline"
90-
spaceX="space-x-3"
91-
truncate={true}
80+
className="space-x-3 truncate"
81+
justifyContent="start"
82+
alignItems="baseline"
9283
>
9384
<Metric>{item.metric}</Metric>
94-
<Text truncate={true}>from {item.metricPrev}</Text>
85+
<Text className="truncate">from {item.metricPrev}</Text>
9586
</Flex>
9687
</Card>
9788
))}
98-
</ColGrid>
99-
<ColGrid
100-
numColsSm={2}
101-
numColsLg={3}
102-
gapX="gap-x-6"
103-
gapY="gap-y-6"
104-
marginTop="mt-8"
105-
>
89+
</Grid>
90+
<Grid className="mt-8 gap-6" numColsSm={2} numColsLg={3}>
10691
{data.map((item) => (
10792
<Card key={item.category}>
10893
<Title>{item.category}</Title>
10994
<Flex
110-
justifyContent="justify-start"
111-
alignItems="items-baseline"
112-
spaceX="space-x-2"
95+
className="space-x-2"
96+
justifyContent="start"
97+
alignItems="baseline"
11398
>
11499
<Metric>{item.stat}</Metric>
115100
<Text>Total views</Text>
116101
</Flex>
117-
<Flex marginTop="mt-6">
102+
<Flex className="mt-6">
118103
<Text>Pages</Text>
119-
<Text textAlignment="text-right">Views</Text>
104+
<Text className="text-right">Views</Text>
120105
</Flex>
121106
<BarList
107+
className="mt-2"
122108
data={item.data}
123109
valueFormatter={dataFormatter}
124-
marginTop="mt-2"
125110
/>
126111
</Card>
127112
))}
128-
</ColGrid>
113+
</Grid>
129114
<Chart />
130115
</main>
131116
);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@headlessui/react": "^1.7.12",
1212
"@heroicons/react": "^2.0.16",
1313
"@planetscale/database": "^1.5.0",
14-
"@tremor/react": "^1.8.1",
14+
"@tremor/react": "^2.0.1",
1515
"@types/js-cookie": "^3.0.3",
1616
"@types/node": "18.14.2",
1717
"@types/react": "18.0.28",

pnpm-lock.yaml

Lines changed: 61 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tailwind.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/** @type {import('tailwindcss').Config} */
22
module.exports = {
3-
content: ['./app/**/*.{js,ts,jsx,tsx}'],
3+
content: [
4+
'./app/**/*.{js,ts,jsx,tsx}',
5+
'./node_modules/@tremor/**/*.{js,ts,jsx,tsx}'
6+
],
47
theme: {
58
extend: {},
69
},

0 commit comments

Comments
 (0)