-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/summary layout #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rlrrrrr
wants to merge
9
commits into
Yadoms:develop
Choose a base branch
from
rlrrrrr:feature/SummaryLayout
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a493a80
feat: readable human format and add grid
40e7e91
feat: readable human format and add grid
247f55c
feat: handle style and responsive
6883604
feat: edit summary layout and handle responsive
5914d97
feat: add skeleton in Card
5e7add7
feat: better management responsive
5aba572
feat: better management responsive
781266e
applying changes requested
35371a9
fix System Icon
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,62 @@ | ||
| import React, { ReactNode } from 'react'; | ||
| import { Badge, Center, Container, Text } from '@mantine/core'; | ||
| import classes from './summary.module.css'; | ||
| import { IsVersion } from '@yadoms/shared'; | ||
|
|
||
| interface CardProps { | ||
| icon: ReactNode; | ||
| label: string; | ||
| content: string | number | undefined; | ||
| color: string; | ||
| isLoading: boolean; | ||
| children: ReactNode; | ||
| } | ||
|
|
||
| export function Card({ | ||
| icon, | ||
| label, | ||
| content, | ||
| color, | ||
| isLoading, | ||
| children, | ||
| }: CardProps) { | ||
| return ( | ||
| <Container | ||
| p={'xl'} | ||
| className={classes.item} | ||
| styles={(theme) => ({ | ||
| root: { | ||
| boxShadow: `0px 0px 20px ${color}`, | ||
| border: `1px solid ${color}`, | ||
| }, | ||
| })} | ||
| > | ||
| <Center>{icon}</Center> | ||
| <Text weight={500} size={{ base: 'xs', sm: 'lg' }}> | ||
| {label} | ||
| </Text> | ||
| {isLoading ? ( | ||
| children | ||
| ) : ( | ||
| <ContentComponent content={content as string}> </ContentComponent> | ||
| )} | ||
| </Container> | ||
| ); | ||
| } | ||
|
|
||
| function ContentComponent({ content }: { content: string }) { | ||
| return IsVersion(content) ? ( | ||
| <VersionComponentWithBadge content={content} /> | ||
| ) : ( | ||
| <Text size={{ base: 'xs', sm: 'lg' }}> | ||
| {Number.isInteger(content) ? `${content} Octets` : content} | ||
| </Text> | ||
| ); | ||
| } | ||
| function VersionComponentWithBadge({ content }: { content: string }) { | ||
| return ( | ||
| <Badge color="pink" variant="light" mt={10}> | ||
| <Text size={{ base: 'xs', sm: 'lg' }}>{content}</Text> | ||
| </Badge> | ||
| ); | ||
| } |
This file contains hidden or 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,38 @@ | ||
| import React, { ReactNode } from 'react'; | ||
| import { useTranslation } from 'react-i18next'; | ||
| import { Container, Grid } from '@mantine/core'; | ||
| import { Card } from './CardComponent'; | ||
| import { SystemInformation } from './summary'; | ||
|
|
||
| interface FeaturesGridProps { | ||
| systemInformations: SystemInformation[]; | ||
| children: ReactNode; | ||
| isLoading: boolean; | ||
| } | ||
|
|
||
| export function FeaturesGrid({ | ||
| systemInformations, | ||
| children, | ||
| isLoading, | ||
| }: FeaturesGridProps) { | ||
| const { t } = useTranslation(); | ||
| return ( | ||
| <Container size={1100}> | ||
| <Grid gutter="xl"> | ||
| {systemInformations.map((element) => ( | ||
| <Grid.Col span={{ base: 12, sm: 4, md: 4, lg: 4 }}> | ||
| <Card | ||
| icon={element.icon} | ||
| label={t(`summary.informations.${element.i18nKey}`)} | ||
| content={element.dataKey} | ||
| color={element.color} | ||
| isLoading={isLoading} | ||
| > | ||
| {children} | ||
| </Card> | ||
| </Grid.Col> | ||
| ))} | ||
| </Grid> | ||
| </Container> | ||
| ); | ||
| } |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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,18 @@ | ||
| .item { | ||
| height: 100%; | ||
| width: 100%; | ||
|
|
||
| transition: box-shadow 150ms ease, transform 100ms ease; | ||
| overflow: clip; | ||
| @mixin hover { | ||
| box-shadow: var(--mantine-shadow-md); | ||
| transform: scale(1.05); | ||
| } | ||
| } | ||
|
|
||
| @media (max-width: 48em) { | ||
| .item { | ||
| display: flex; | ||
| flex-direction: column; | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for the latest else