Skip to content

Commit

Permalink
Merge pull request #18261 from brave/allow-full-width-portfolio-graph
Browse files Browse the repository at this point in the history
feat(wallet): Allow Full Width Portfolio Graph
  • Loading branch information
Douglashdaniel authored Apr 27, 2023
2 parents fec6c49 + 156d36a commit 839d3e8
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function LineChart ({
<LoadingOverlay isLoading={isLoading}>
<LoadIcon />
</LoadingOverlay>
<ResponsiveContainer width='99%' height='99%'>
<ResponsiveContainer width='100%' height='99%'>
<AreaChart
data={chartData}
margin={{ top: 5, left: 0, right: 0, bottom: 0 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ interface Props {
enableScroll?: boolean
maxListHeight?: string
estimatedItemSize: number
horizontalPadding?: number
}

export const TokenLists = ({
Expand All @@ -67,7 +68,8 @@ export const TokenLists = ({
maxListHeight,
hideAssetFilter,
hideAccountFilter,
hideAutoDiscovery
hideAutoDiscovery,
horizontalPadding
}: Props) => {
// routing
const history = useHistory()
Expand Down Expand Up @@ -210,7 +212,7 @@ export const TokenLists = ({
// render
return (
<>
<FilterTokenRow>
<FilterTokenRow horizontalPadding={horizontalPadding}>

<Column flex={1} style={{ minWidth: '25%' }} alignItems='flex-start'>
<SearchBar
Expand All @@ -234,15 +236,24 @@ export const TokenLists = ({

{enableScroll
? (
<ScrollableColumn maxHeight={maxListHeight}>
<ScrollableColumn
maxHeight={maxListHeight}
padding={
`0px ${horizontalPadding !== undefined
? horizontalPadding
: 0}px`
}
>
{listUi}
</ScrollableColumn>
)
: listUi
}

{!hideAddButton &&
<ButtonRow>
<ButtonRow
horizontalPadding={horizontalPadding}
>
<AddButton
buttonType='secondary'
onSubmit={showAddAssetsModal}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ export const PortfolioOverview = () => {
networks={networks || []}
estimatedItemSize={58}
enableScroll={true}
horizontalPadding={20}
renderToken={({ item, viewMode }) =>
viewMode === 'list'
? <PortfolioAssetItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,22 @@ export const PriceText = styled.span`
color: ${(p) => p.theme.color.text01};
`

export const ButtonRow = styled.div<{ noMargin?: boolean }>`
export const ButtonRow = styled.div<
{
noMargin?: boolean,
horizontalPadding?: number
}>`
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
width: 100%;
margin: ${(p) => p.noMargin ? '0px' : '20px 0px'};
padding: 0px ${(p) =>
p.horizontalPadding !== undefined
? p.horizontalPadding
: 0
}px;
`

export const BalanceRow = styled.div<{ gap?: string }>`
Expand Down Expand Up @@ -241,12 +250,20 @@ export const CoinGeckoText = styled.span`
margin: 15px 0px;
`

export const FilterTokenRow = styled.div`
export const FilterTokenRow = styled.div<
{
horizontalPadding?: number
}>`
display: flex;
flex-direction: row;
flex-wrap: wrap;
width: 100%;
gap: 14px;
padding: 0px ${(p) =>
p.horizontalPadding !== undefined
? p.horizontalPadding
: 0
}px;
`

export const NftMultimedia = styled.iframe<{ visible?: boolean }>`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export const LayoutCardWrapper = styled.div<{

export const ContainerCard = styled.div<
{
cardOverflow?: 'auto' | 'hidden' | 'visible'
cardOverflow?: 'auto' | 'hidden' | 'visible',
noPadding?: boolean
}>`
display: flex;
flex-direction: column;
Expand All @@ -51,7 +52,7 @@ export const ContainerCard = styled.div<
box-sizing: border-box;
justify-content: flex-start;
align-items: center;
padding: 20px;
padding: ${(p) => p.noPadding ? 0 : 20}px;
width: 100%;
min-height: ${minCardHeight}px;
max-height: calc(100vh - 132px);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export const WalletPageWrapper = (props: Props) => {
>
<ContainerCard
cardOverflow={cardOverflow}
noPadding={walletLocation === WalletRoutes.Portfolio}
>
{children}
</ContainerCard>
Expand Down

0 comments on commit 839d3e8

Please sign in to comment.