-
Notifications
You must be signed in to change notification settings - Fork 44
feat: migrate DetailInfo to mui #1457
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
54d48e3
feat: migrate DetailInfo to mui
DanielSchiavini ee61195
refactor: cleanup DetailInfo
DanielSchiavini e961151
Merge branch 'main' of github.com:curvefi/curve-frontend into feat/ac…
DanielSchiavini cc3d4fa
feat: restore old DetailInfo for stable mode
DanielSchiavini 46e7952
Merge branch 'main' of github.com:curvefi/curve-frontend into feat/ac…
DanielSchiavini 758f400
Merge branch 'main' of github.com:curvefi/curve-frontend into feat/ac…
DanielSchiavini 009b3ab
chore: self-review
DanielSchiavini 7aaa7f6
fix: skeleton size
DanielSchiavini 0fd4d52
Merge branch 'main' of github.com:curvefi/curve-frontend into feat/ac…
DanielSchiavini 1012b12
fix: review comments
DanielSchiavini 62d7684
feat: show error and value when possible
DanielSchiavini e1f714a
Merge branch 'main' into feat/action-info
DanielSchiavini 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
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 |
---|---|---|
@@ -1,38 +1,18 @@ | ||
import React from 'react' | ||
import React, { ReactNode } from 'react' | ||
import { default as Skeleton, SkeletonProps } from '@mui/material/Skeleton' | ||
import { WithWrapper } from '@ui-kit/shared/ui/WithWrapper' | ||
|
||
/** | ||
* A component that wraps children with a Skeleton when loading. | ||
* Useful for when you want to use the same child for dimension inference. | ||
* | ||
* @example | ||
* ```tsx | ||
* // Basic usage | ||
* <WithSkeleton loading={isLoading}> | ||
* <Typography>Content to show when loaded</Typography> | ||
* </WithSkeleton> | ||
* | ||
* // With metrics | ||
* <WithSkeleton loading={isDataLoading}> | ||
* <Metric | ||
* label="Total Value" | ||
* value={totalValue} | ||
* unit="$" | ||
* /> | ||
* </WithSkeleton> | ||
* | ||
* // With custom skeleton props | ||
* <WithSkeleton loading={isLoading} variant="rectangular" width={200} height={40}> | ||
* <Typography>Content to show when loaded</Typography> | ||
* </WithSkeleton> | ||
* ``` | ||
*/ | ||
type WithSkeletonProps = { | ||
/** Whether to show the skeleton or the children */ | ||
loading: boolean | ||
/** Content to render when not loading, also used for skeleton dimension inference */ | ||
children: React.ReactNode | ||
children: ReactNode | ||
} & SkeletonProps | ||
|
||
export const WithSkeleton = ({ loading, children, ...skeletonProps }: WithSkeletonProps) => | ||
loading ? <Skeleton {...skeletonProps}>{children}</Skeleton> : <>{children}</> | ||
/** | ||
* A component that wraps children with a Skeleton when loading. | ||
* Useful for when you want to use the same child for dimension inference. | ||
*/ | ||
export const WithSkeleton = ({ loading, ...skeletonProps }: WithSkeletonProps) => ( | ||
<WithWrapper Wrapper={Skeleton} wrap={loading} {...skeletonProps} /> | ||
) |
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,10 @@ | ||
import React from 'react' | ||
DanielSchiavini marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import { default as Tooltip, TooltipProps } from '@mui/material/Tooltip' | ||
import { WithWrapper } from '@ui-kit/shared/ui/WithWrapper' | ||
|
||
/** | ||
* A component that wraps children with a Tooltip when a title is provided. | ||
* Useful for when you want to use the same child and don't know whether a tooltip is needed. | ||
* The `title` passed to the Tooltip component is used to determine whether the tooltip should be rendered. | ||
*/ | ||
export const WithTooltip = (props: TooltipProps) => <WithWrapper Wrapper={Tooltip} wrap={!!props.title} {...props} /> |
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,17 @@ | ||
import React, { ReactNode } from 'react' | ||
DanielSchiavini marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
type WithWrapperProps<Props> = Props & { | ||
/** Whether wrapper should be applied */ | ||
wrap: boolean | ||
/** Component to use as a wrapper */ | ||
Wrapper: (props: Props & { children: ReactNode }) => ReactNode | ||
/** Children to be wrapped */ | ||
children: ReactNode | ||
} | ||
|
||
/** | ||
* A component that wraps children with a given Wrapper component when `wrap` is true. | ||
* Useful for conditionally applying a wrapper component based on a boolean prop. | ||
*/ | ||
export const WithWrapper = <Props,>({ wrap, Wrapper, children, ...wrapperProps }: WithWrapperProps<Props>) => | ||
wrap ? <Wrapper {...(wrapperProps as Props)}>{children}</Wrapper> : children |
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.
Uh oh!
There was an error while loading. Please reload this page.