-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #821 from safe-global/chore/normalize-tx-builder-t…
…heme feat(transaction-builder-theme): Remove safe-react-components from transaction builder
- Loading branch information
Showing
102 changed files
with
3,894 additions
and
424 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
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,87 @@ | ||
import { ReactElement } from 'react' | ||
import AccordionMUI, { AccordionProps as AccordionMUIProps } from '@material-ui/core/Accordion' | ||
import AccordionSummaryMUI, { | ||
AccordionSummaryProps as AccordionSummaryMUIProps, | ||
} from '@material-ui/core/AccordionSummary' | ||
import styled from 'styled-components' | ||
import FixedIcon from '../FixedIcon' | ||
|
||
type AccordionProps = AccordionMUIProps & { | ||
compact?: boolean | ||
} | ||
|
||
type StyledAccordionProps = AccordionMUIProps & { | ||
$compact?: AccordionProps['compact'] | ||
} | ||
|
||
const StyledAccordion = styled(AccordionMUI)<StyledAccordionProps>` | ||
&.MuiAccordion-root { | ||
border-radius: ${({ $compact }) => ($compact ? '8px' : '0')}; | ||
border: ${({ $compact, theme }) => ($compact ? '2px solid ' + theme.palette.divider : 'none')}; | ||
border-bottom: 2px solid ${({ theme }) => theme.palette.divider}; | ||
margin-bottom: ${({ $compact }) => ($compact ? '16px' : '0')}; | ||
overflow: hidden; | ||
&:before { | ||
height: 0; | ||
} | ||
&:first-child { | ||
border-top: 2px solid ${({ theme }) => theme.palette.divider}; | ||
} | ||
&.Mui-expanded { | ||
margin: ${({ $compact }) => ($compact ? '0 0 16px 0' : '0')}; | ||
} | ||
.MuiAccordionDetails-root { | ||
padding: 16px; | ||
} | ||
} | ||
` | ||
|
||
const StyledAccordionSummary = styled(AccordionSummaryMUI)` | ||
&.MuiAccordionSummary-root { | ||
&.Mui-expanded { | ||
min-height: 48px; | ||
border-bottom: 2px solid ${({ theme }) => theme.palette.divider}; | ||
background-color: ${({ theme }) => theme.palette.background.default}; | ||
} | ||
&:hover { | ||
background-color: ${({ theme }) => theme.palette.background.default}; | ||
} | ||
.MuiAccordionSummary-content { | ||
&.Mui-expanded { | ||
margin: 0; | ||
} | ||
} | ||
.MuiIconButton-root { | ||
font-size: 0; | ||
padding: 16px; | ||
} | ||
} | ||
` | ||
|
||
export const Accordion = ({ compact, children, ...props }: AccordionProps): ReactElement => { | ||
return ( | ||
<StyledAccordion square elevation={0} $compact={compact} {...props}> | ||
{children} | ||
</StyledAccordion> | ||
) | ||
} | ||
|
||
export const AccordionSummary = ({ | ||
children, | ||
...props | ||
}: AccordionSummaryMUIProps): ReactElement => { | ||
return ( | ||
<StyledAccordionSummary expandIcon={<FixedIcon type="chevronDown" />} {...props}> | ||
{children} | ||
</StyledAccordionSummary> | ||
) | ||
} | ||
|
||
export { default as AccordionActions } from '@material-ui/core/AccordionActions' | ||
export { default as AccordionDetails } from '@material-ui/core/AccordionDetails' |
Oops, something went wrong.