generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 106
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
feat: move custom button to styled #585
Draft
nebula-aac
wants to merge
1
commit into
master
Choose a base branch
from
583-button-variants
base: master
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.
Draft
Changes from all commits
Commits
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 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,193 @@ | ||
import { styled } from '@mui/material/styles'; | ||
import React from 'react'; | ||
import Button, { ButtonProps } from '../../base/Button/Button'; | ||
import { darkTeal } from '../../theme/colors'; | ||
|
||
export function ContainedButton(props: ButtonProps): React.JSX.Element { | ||
return <Button variant="contained" {...props} />; | ||
} | ||
|
||
export function OutlinedButton(props: ButtonProps): React.JSX.Element { | ||
return <Button variant="outlined" {...props} />; | ||
} | ||
|
||
export function TextButton(props: ButtonProps): React.JSX.Element { | ||
return <Button variant="text" {...props} />; | ||
} | ||
|
||
export function SecondaryContainedButton(props: ButtonProps): React.JSX.Element { | ||
return <Button variant="contained" color="secondary" {...props} />; | ||
} | ||
|
||
export function LargeContainedButton(props: ButtonProps): React.JSX.Element { | ||
return <Button variant="contained" size="large" {...props} />; | ||
} | ||
|
||
/** | ||
* Renders the default style for the Button | ||
*/ | ||
export const DefaultButton = styled(Button)(() => ({})); | ||
|
||
/** | ||
* Renders the style for `variant="contained"` | ||
*/ | ||
export const ContainedDefaultButton = styled(ContainedButton)(() => ({})); | ||
|
||
/** | ||
* Renders the style for `variant="outlined"` | ||
*/ | ||
export const OutlinedDefaultButton = styled(OutlinedButton)(() => ({})); | ||
|
||
/** | ||
* Renders the style for `variant="text"` | ||
*/ | ||
export const TextDefaultButton = styled(TextButton)(() => ({})); | ||
|
||
/** | ||
* Renders the style for `variant="contained" color="secondary"` | ||
*/ | ||
export const SecondaryContainedDefaultButton = styled(SecondaryContainedButton)(() => ({})); | ||
|
||
/** | ||
* Exports the `StyledButton` which inherits the `DefaultButton` | ||
*/ | ||
export const StyledButton = DefaultButton; | ||
|
||
export const GetStartedButton = styled(ContainedDefaultButton)(() => ({})); | ||
|
||
export const LoginButton = styled(SecondaryContainedButton)(() => ({})); | ||
|
||
export const AddButton = styled(ContainedDefaultButton)(({ theme }) => ({ | ||
margin: theme.spacing(1) | ||
})); | ||
|
||
export const EditButton = styled(ContainedDefaultButton)(() => ({ | ||
'@media (max-width: 768px)': { | ||
minWidth: '50px' | ||
} | ||
})); | ||
|
||
export const SpanTextButton = styled('span')(() => ({ | ||
marginLeft: '0.5rem', | ||
display: 'block', | ||
'@media (max-width: 853px)': { | ||
display: 'none' | ||
} | ||
})); | ||
|
||
export const DeleteButton = styled(DefaultButton)(() => ({})); | ||
|
||
export const DenyButton = styled(DefaultButton)(() => ({})); | ||
|
||
export const ApproveButton = styled(ContainedDefaultButton)(() => ({ | ||
marginRight: '.5rem' | ||
})); | ||
|
||
export const CancelButton = styled(DefaultButton)(() => ({ | ||
marginRight: '1rem', | ||
color: '#000', | ||
backgroundColor: '#fff' | ||
})); | ||
|
||
export const SaveButton = styled(ContainedDefaultButton)(() => ({ | ||
marginRight: '1rem' | ||
})); | ||
|
||
export const ConnectButton = styled(ContainedDefaultButton)(() => ({ | ||
marginTop: '1rem' | ||
})); | ||
|
||
export const FilterButton = styled(ContainedDefaultButton)(() => ({ | ||
height: '3.5rem' | ||
})); | ||
|
||
export const ActionButton = styled(ContainedDefaultButton)(() => ({})); | ||
|
||
export const TableCtrlButton = styled(SecondaryContainedDefaultButton)(() => ({ | ||
'&:first-child': { | ||
marginRight: '1rem' | ||
} | ||
})); | ||
|
||
export const RangeButton = styled(DefaultButton)(() => ({ | ||
border: '1px solid rgba(0, 0, 0, 0.23)', | ||
backgroundColor: 'white' | ||
})); | ||
|
||
export const ErrorCloseButton = styled(DefaultButton)(() => ({})); | ||
|
||
export const TryAgainButton = styled(OutlinedButton)(() => ({})); | ||
|
||
export const TransferButton = styled(DefaultButton)(() => ({ | ||
margin: '5px 0', | ||
padding: '7px 0', | ||
borderRadius: '10px', | ||
boxShadow: 'none', | ||
borderColor: darkTeal.main, | ||
'&:hover': { | ||
borderColor: darkTeal.main | ||
} | ||
})); | ||
|
||
export const CardStatsBox = styled(ContainedDefaultButton)(() => ({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
flexDirection: 'column', | ||
padding: '5px', | ||
minWidth: '175px', | ||
borderRadius: '5px', | ||
marginBottom: '10px' | ||
})); | ||
|
||
export const IconButton = styled(DefaultButton)({ | ||
minWidth: 'fit-content', | ||
'&.MuiButtonBase-root:hover': { | ||
bgcolor: 'transparent' | ||
} | ||
}); | ||
|
||
export const PopupButton = styled(DefaultButton)(({ theme }) => ({ | ||
width: '100%', | ||
borderRadius: '4px', | ||
background: theme.palette.common.white, | ||
color: theme.palette.text.secondary, | ||
boxShadow: '0px 4px 4px 0px rgba(0, 0, 0, 0.25)', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
marginBottom: '10px' | ||
})); | ||
|
||
export const ConnectionsButton = styled(ContainedDefaultButton)(() => ({ | ||
marginTop: '1rem', | ||
marginRight: '1rem', | ||
padding: '1.5rem, 1.5rem', | ||
width: 'object-fit' | ||
})); | ||
|
||
/** Review later | ||
export const TOSButton = styled("a")(({ theme }) => ({ | ||
display: "flex", | ||
padding: "0.5rem 2rem", | ||
color: theme.palette.common.white, | ||
backgroundColor: theme.palette.keppelGreen, | ||
borderRadius: "5px", | ||
transition: "all .3s", | ||
boxShadow: "0 1px 20px rgba(0, 0, 0, 0.2)", | ||
"&:hover": { | ||
backgroundColor: theme.palette.caribbeanGreen, | ||
}, | ||
})); | ||
|
||
export const PrivacyButton = styled("a")(({ theme }) => ({ | ||
display: "flex", | ||
padding: "0.5rem 2rem", | ||
color: theme.palette.common.white, | ||
backgroundColor: theme.palette.keppelGreen, | ||
borderRadius: "5px", | ||
transition: "all .3s", | ||
boxShadow: "0 1px 20px rgba(0, 0, 0, 0.2)", | ||
"&:hover": { | ||
backgroundColor: theme.palette.caribbeanGreen, | ||
}, | ||
})); | ||
*/ |
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 @@ | ||
export * from './button'; |
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.
Lots of options here. 😃