Skip to content

Commit

Permalink
fix: remove grid from transparency page and improve css (#1310)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyesp authored Oct 3, 2023
1 parent 808646f commit bde19a1
Show file tree
Hide file tree
Showing 9 changed files with 224 additions and 287 deletions.
2 changes: 1 addition & 1 deletion src/components/Common/Typography/Heading.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}

.Heading--weight-normal {
font-weight: var(--weight-light);
font-weight: var(--weight-normal);
}

.Heading--weight-semi-bold {
Expand Down
27 changes: 9 additions & 18 deletions src/components/Transparency/GrantList.css
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
.ui.sub.header.GrantList__Sub {
.GrantList__Total {
margin-bottom: 8px;
}

.GrantList__Title {
border-bottom: 1px solid rgba(34, 36, 38, 0.1);
padding-bottom: 1em;
margin-bottom: 0;
text-transform: uppercase;
}

.ui.header.GrantList__Total {
font-size: x-large;
font-weight: var(--weight-semi-bold);
}

.content.GrantList__Content {
.GrantList__Content {
border-top: 0 !important;
}

.ItemsList {
width: 100%;
display: block;
margin-top: 0;
margin-bottom: 0;
padding-top: 16px;
position: relative;
}

a.GrantList__Link {
color: #6299f0;
.GrantList__Link {
color: var(--blue-800);
font-weight: var(--weight-semi-bold);
font-size: 17px;
display: flex;
Expand Down
73 changes: 36 additions & 37 deletions src/components/Transparency/GrantList.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
import React, { useMemo } from 'react'
import { useMemo } from 'react'

import { Card } from 'decentraland-ui/dist/components/Card/Card'
import { Header } from 'decentraland-ui/dist/components/Header/Header'

import { ProposalStatus, ProposalType } from '../../entities/Proposal/types'
import { formatBalance } from '../../entities/Proposal/utils'
import useFormatMessage from '../../hooks/useFormatMessage'
import useProposals from '../../hooks/useProposals'
import locations from '../../utils/locations'
import Heading from '../Common/Typography/Heading'
import Link from '../Common/Typography/Link'
import Text from '../Common/Typography/Text'
import { DetailItem } from '../Proposal/View/DetailItem'

import './GrantList.css'
import ItemsList from './ItemsList'

export type GrantListProps = React.HTMLAttributes<HTMLDivElement> & {
type Props = {
status: ProposalStatus
title: string
}

const ITEMS_PER_PAGE = 5

export default React.memo(function GrantList({ status, title }: GrantListProps) {
export default function GrantList({ status, title }: Props) {
const t = useFormatMessage()
const { proposals: grantsList } = useProposals({
type: ProposalType.Grant,
Expand All @@ -30,38 +32,35 @@ export default React.memo(function GrantList({ status, title }: GrantListProps)
})
const additionalGrants = useMemo(() => (grantsList ? grantsList.total - grantsList.data.length : 0), [grantsList])

if (!grantsList) {
return null
}

return (
<>
{grantsList && (
<Card.Content className="GrantList__Content">
<Header size="medium" className="GrantList__Total">
{grantsList.total}
</Header>
<Header sub className="GrantList__Sub">
{title}
</Header>
<div className="ItemsList">
{grantsList.data &&
grantsList.data.map((grant, index) => {
return (
<DetailItem
name={grant.title}
value={'$' + formatBalance(grant.configuration.size)}
key={[title.trim(), index].join('::')}
/>
)
})}
{additionalGrants > 0 && (
<Link
href={locations.proposals({ type: ProposalType.Grant, status: status })}
className="GrantList__Link"
>
{t('page.transparency.funding.view_more', { count: additionalGrants })}
</Link>
)}
</div>
</Card.Content>
)}
</>
<Card.Content className="GrantList__Content">
<Heading size="md" weight="semi-bold" className="GrantList__Total">
{grantsList.total}
</Heading>
<Text size="sm" className="GrantList__Title">
{title}
</Text>
<ItemsList>
{grantsList.data &&
grantsList.data.map((grant, index) => {
return (
<DetailItem
name={grant.title}
value={'$' + formatBalance(grant.configuration.size)}
key={[title.trim(), index].join('::')}
/>
)
})}
{additionalGrants > 0 && (
<Link href={locations.proposals({ type: ProposalType.Grant, status: status })} className="GrantList__Link">
{t('page.transparency.funding.view_more', { count: additionalGrants })}
</Link>
)}
</ItemsList>
</Card.Content>
)
})
}
8 changes: 8 additions & 0 deletions src/components/Transparency/ItemsList.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.ItemsList {
width: 100%;
display: block;
margin-top: 0;
margin-bottom: 0;
padding-top: 16px;
position: relative;
}
9 changes: 9 additions & 0 deletions src/components/Transparency/ItemsList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import './ItemsList.css'

interface Props {
children: React.ReactNode
}

export default function ItemsList({ children }: Props) {
return <div className="ItemsList">{children}</div>
}
2 changes: 1 addition & 1 deletion src/components/Transparency/MembersSection.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
color: var(--white-900) !important;
}

.TransparencySection .MembersContainer {
.MembersContainer {
display: flex;
flex-wrap: wrap;
}
5 changes: 3 additions & 2 deletions src/components/Transparency/MonthlyTotal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { formatBalance } from '../../entities/Proposal/utils'
import useFormatMessage from '../../hooks/useFormatMessage'
import { DetailItem } from '../Proposal/View/DetailItem'

import ItemsList from './ItemsList'
import './MonthlyTotal.css'

enum Color {
Expand Down Expand Up @@ -66,7 +67,7 @@ export default function MonthlyTotal({ title, monthlyTotal, invertDiffColors = f
</div>
</Card.Content>
<Card.Content className={classNames('MonthlyTotal__Detail', detailsVisibility)}>
<div className="ItemsList">
<ItemsList>
{monthlyTotal.details &&
monthlyTotal.details.map((detail, index) => {
return (
Expand All @@ -78,7 +79,7 @@ export default function MonthlyTotal({ title, monthlyTotal, invertDiffColors = f
/>
)
})}
</div>
</ItemsList>
</Card.Content>
{monthlyTotal.details.length > MAX_TAGS && (
<Button basic onClick={handleButtonClick}>
Expand Down
129 changes: 33 additions & 96 deletions src/pages/transparency.css
Original file line number Diff line number Diff line change
@@ -1,140 +1,77 @@
.Transparency__Loader {
position: relative;
padding-top: 200px;
.TransparencyGrid {
display: flex;
flex-direction: column;
gap: 32px;
margin-bottom: 32px;
}

.TransparencySectionDescription {
margin-top: 24px;
@media (min-width: 768px) {
.TransparencyGrid {
flex-direction: row;
}
}

.TransparencySection {
margin-top: 0 !important;
.Transparency__Sidebar {
width: 100%;
}

.TransparencySection .ActionableLayout__Action {
display: none !important;
@media (min-width: 768px) {
.Transparency__Sidebar {
max-width: var(--dao-sidebar-width);
}
}

.TransparencySection .ui.header {
margin-bottom: 0.5rem;
.Transparency__BalanceCard {
margin-bottom: 12px;
}

.TransparencySection .ui.header.sub {
margin-top: 0;
margin-right: 1rem;
.Transparency__Section {
width: 100%;
}

.TransparencySection .TokenContainer {
.Transparecy__TokenContainer {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
}

.TransparencySection .Token:last-of-type {
.Transparency__Section .Token:last-of-type {
margin-bottom: 0;
}

.ui.container.TransparencyContainer .ActionableLayout {
position: relative;
margin-top: 40px;
}

.ui.container.TransparencyContainer .ui.card {
width: 100%;
height: auto;
margin-bottom: 8px;
}

.ui.stackable.grid.TransparencyGrid {
flex-grow: 1;
}

@media only screen and (min-width: 992px) {
.ui.container.TransparencyContainer .ActionableLayout {
flex: 0 0 32%;
}

.MonthlyTotals {
display: flex;
flex-direction: row !important;
justify-content: space-evenly;
}
}

@media only screen and (min-width: 768px) and (max-width: 991px) {
.ui.container.TransparencyContainer .ActionableLayout {
flex: 0 0 49%;
}

.ui.container.TransparencyContainer {
width: 95%;
}
}

@media only screen and (max-width: 767px) {
.TransparencyPage {
min-height: 300px;
}

.Funding {
margin: 30px 0 !important;
}
}

@media only screen and (max-width: 767px) {
.ui.container.TransparencyContainer .ActionableLayout {
flex: 0 0 100%;
}
}

.MonthlyTotals {
.Transparency__MonthlyTotals {
display: flex;
flex-direction: column;
gap: 12px;
}

.ui.card.TransparencyCard {
width: 100%;
@media (min-width: 1200px) {
.Transparency__MonthlyTotals {
display: flex;
flex-direction: row;
justify-content: space-evenly;
}
}

.ui.header.FundingHeader {
font-size: 20px;
line-height: 28px;
font-weight: var(--weight-normal);
.Transparency__Card {
width: 100% !important;
}

.FundingProgress .FundingProgress__Description {
.Transparency__FundingProgressDescription {
display: flex;
justify-content: space-between;
color: var(--text);
flex-wrap: wrap;
}

.ui.huge.header.FundingProgress__Total {
.ui.huge.header.Transparency__FundingProgressTotal {
margin-bottom: 0;
display: flex;
align-items: baseline;
font-weight: var(--weight-normal);
}

.FundingProgress .FundingProgress__Budget {
display: flex;
flex-direction: column;
justify-content: flex-end;
font-size: 15px;
text-align: right;
padding-left: 1em;
}

.FundingProgress .Progress {
margin-top: 8px;
}

.TransparencySection .ui.card > .content > .header,
.Transparency__Section .ui.card > .content > .header,
.ui.cards > .card > .content > .header {
font-family: inherit;
}

.TransparencySection__BalanceCard {
margin-bottom: 12px;
}
Loading

0 comments on commit bde19a1

Please sign in to comment.