From c33ffbf27d66b36d681baeac151a8ce54d69a35f Mon Sep 17 00:00:00 2001 From: Hristo Nedelkov Date: Mon, 7 Aug 2023 11:24:37 +0300 Subject: [PATCH] Run demo of nivo/pie --- src/App.tsx | 242 +++++++++++++--------------------------------------- 1 file changed, 59 insertions(+), 183 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 92899866..2a425ab9 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,199 +1,75 @@ - - -import { TamaguiProvider } from 'tamagui' import './App.css' -import { Provider as StatusProvider } from '@status-im/components' +import { TamaguiProvider } from 'tamagui' +import { Provider as StatusProvider } from '@status-im/components' import { ResponsivePie } from '@nivo/pie' import config from '../tamagui.config' -const data = [ - { - "id": "php", - "label": "php", - "value": 127, - "color": "hsl(236, 70%, 50%)" - }, - { - "id": "javascript", - "label": "javascript", - "value": 540, - "color": "hsl(249, 70%, 50%)" - }, - { - "id": "java", - "label": "java", - "value": 240, - "color": "hsl(72, 70%, 50%)" - }, - { - "id": "python", - "label": "python", - "value": 435, - "color": "hsl(122, 70%, 50%)" - }, - { - "id": "scala", - "label": "scala", - "value": 197, - "color": "hsl(186, 70%, 50%)" - } -] + interface Data { - id: string; - label: string; - value: number; - color: string; + id: string + label: string + value: number + color: string } interface MyPieProps { - data: Data[]; + data: Data[] } - -const MyResponsivePie = (props:MyPieProps) => { - - const {data}= props; -return( - <> - - ) - } - +const MyResponsivePie = (props: MyPieProps) => { + const { data } = props + return ( + <> + + + ) +} function App() { - + const data: Data[] = [ + { + id: 'php', + label: 'php', + value: 127, + color: 'hsl(236, 70%, 50%)', + }, + { + id: 'javascript', + label: 'javascript', + value: 540, + color: 'hsl(249, 70%, 50%)', + }, + { + id: 'java', + label: 'java', + value: 240, + color: 'hsl(72, 70%, 50%)', + }, + { + id: 'python', + label: 'python', + value: 435, + color: 'hsl(122, 70%, 50%)', + }, + { + id: 'scala', + label: 'scala', + value: 197, + color: 'hsl(186, 70%, 50%)', + }, + ] + return ( - -
- - -
+ +
+ +
)