-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add responsive for components of parking mode
Showing
13 changed files
with
255 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
import { Statistic } from './Statistic'; | ||
|
||
export interface ScoreStatisticProps { | ||
title: React.ReactNode; | ||
score: number; | ||
description?: React.ReactNode; | ||
tip?: React.ReactNode; | ||
className?: string; | ||
} | ||
|
||
export const ScoreStatistic = ({ | ||
title, | ||
score, | ||
description, | ||
tip, | ||
className, | ||
}: ScoreStatisticProps) => { | ||
return ( | ||
<Statistic title={title} tip={tip} description={description} className={className}> | ||
<div className="xl:w-[280px] md:w-[160px] sm:w-[140px] w-[122px] flex justify-center items-end"> | ||
<span>{score}</span> | ||
<span className="xl:text-xl md:text-sm text-[10px] text-[#d6d6d6] leading-6">/100</span> | ||
</div> | ||
</Statistic> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from 'react'; | ||
import { Statistic } from './Statistic'; | ||
import { usePrettyPrice } from '../hooks/usePrettyPrice'; | ||
|
||
export interface ValueStatisticProps { | ||
title: React.ReactNode; | ||
value: number; | ||
unit: string; | ||
description?: React.ReactNode; | ||
tip?: React.ReactNode; | ||
className?: string; | ||
} | ||
|
||
export const ValueStatistic = ({ | ||
title, | ||
value, | ||
unit, | ||
description, | ||
tip, | ||
className, | ||
}: ValueStatisticProps) => { | ||
const prettyValue = usePrettyPrice(value, 0); | ||
return ( | ||
<Statistic title={title} tip={tip} description={description} className={className}> | ||
<div className="flex items-end"> | ||
<span className="mr-[0.5em]">{prettyValue}</span> | ||
<span className="xl:text-xl md:text-sm text-[10px] text-[#d6d6d6] leading-6">{unit}</span> | ||
</div> | ||
</Statistic> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from './Statistic'; | ||
export * from './ValueStatistic'; | ||
export * from './ScoreStatistic'; | ||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
src/stories/Pages/ParkingMode/Statistic/ScoreStatistic.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import '../../../../index.css'; | ||
import '../../../../App.css'; | ||
import { ScoreStatistic } from '../../../../pages/ParkingMode/Statistic/ScoreStatistic'; | ||
|
||
const meta = { | ||
title: 'Pages/ParkingMode/Statistic/Variants/ScoreStatistic', | ||
component: ScoreStatistic, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
} satisfies Meta<typeof ScoreStatistic>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
argTypes: { | ||
title: { control: 'text' }, | ||
tip: { control: 'text' }, | ||
score: { control: 'number' }, | ||
description: { control: 'text' }, | ||
className: { control: 'text' }, | ||
}, | ||
args: { | ||
title: 'Value', | ||
tip: 'Tips!', | ||
score: 100, | ||
description: 'Perfect', | ||
className: '', | ||
}, | ||
tags: ['autodocs'], | ||
}; | ||
|
||
export const NameScore: Story = { | ||
argTypes: { | ||
score: { control: 'number' }, | ||
provider: { control: 'string' }, | ||
tip: { control: 'text' }, | ||
} as any, | ||
args: { | ||
score: 87, | ||
provider: 'XXXXXX', | ||
tip: 'Tips!', | ||
} as any, | ||
tags: ['autodocs'], | ||
render: ({ score, provider, tip }: any) => { | ||
return ( | ||
<ScoreStatistic | ||
title="Name Score" | ||
tip={tip} | ||
score={score} | ||
description={<div className="flex justify-end">by {provider}</div>} | ||
/> | ||
); | ||
}, | ||
}; |
Oops, something went wrong.