Additional bounties alignment (#4704)

* Additional bounties alignment

* Button adjust
This commit is contained in:
Jaco Greeff 2021-02-20 14:58:45 +01:00 committed by GitHub
parent 3c36509040
commit 0f69839626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 126 deletions

View File

@ -6,7 +6,6 @@ import styled from 'styled-components';
import Summary from '@polkadot/app-bounties/Summary';
import { Button, Table } from '@polkadot/react-components';
import { ThemeProps } from '@polkadot/react-components/types';
import Bounty from './Bounty';
import BountyCreate from './BountyCreate';
@ -22,14 +21,10 @@ function Bounties ({ className }: Props): React.ReactElement {
const { bestNumber, bounties } = useBounties();
const headerRef = useRef([
[t('status'), 'start'],
[t('title'), 'start'],
[],
[t('bounties'), 'start', 3],
[t('value'), 'start'],
[t('curator'), 'start'],
[t('next action'), 'start'],
[],
[]
[t('next action'), 'start', 3]
]);
return (
@ -41,7 +36,6 @@ function Bounties ({ className }: Props): React.ReactElement {
<Table
className='bounties-table-wrapper'
empty={bounties && t<string>('No open bounties')}
hasTitle={false}
header={headerRef.current}
>
{bounties && bestNumber &&
@ -63,7 +57,7 @@ function Bounties ({ className }: Props): React.ReactElement {
);
}
export default React.memo(styled(Bounties)(({ theme }: ThemeProps) => `
export default React.memo(styled(Bounties)`
.bounties-table-wrapper table {
background: none;
@ -96,18 +90,4 @@ export default React.memo(styled(Bounties)(({ theme }: ThemeProps) => `
filter: initial;
opacity: 1;
}
.ui--Table th:first-child h1 {
padding: 0;
font-weight: ${theme.fontWeightBold};
font-size: 0.7rem;
line-height: 0.85rem;
text-transform: uppercase;
color: ${theme.colorLabel};
border: none;
svg {
display: none;
}
}
`));
`);

View File

@ -10,6 +10,7 @@ import styled from 'styled-components';
import { AddressSmall, Icon, LinkExternal } from '@polkadot/react-components';
import { ThemeProps } from '@polkadot/react-components/types';
import { FormatBalance } from '@polkadot/react-query';
import { formatNumber } from '@polkadot/util';
import BountyActionMessage from './BountyNextActionInfo/BountyActionMessage';
import { getProposalToDisplay } from './helpers/extendedStatuses';
@ -65,18 +66,18 @@ function Bounty ({ bestNumber, bounty, className = '', description, index, propo
return (
<>
<tr className={`${className}${isExpanded ? ' noBorder' : ''} isOdd`}>
<td>
<BountyStatusView bountyStatus={bountyStatus}/>
</td>
<td className='number'><h1>{formatNumber(index)}</h1></td>
<td
className='description-column'
colSpan={2}
data-testid='description'
>
<div title={description}>
{description}
</div>
</td>
<td>
<BountyStatusView bountyStatus={bountyStatus}/>
</td>
<td><FormatBalance value={value} /></td>
<td>
{curatorToRender && (
@ -159,10 +160,6 @@ function Bounty ({ bestNumber, bounty, className = '', description, index, propo
<div className='label'>{t('Proposer')}</div>
<AddressSmall value={proposer} />
</div>
<div className='label-column-left'>
<div className='label'>{t('Id')}</div>
{index.toString()}
</div>
</td>
<td colSpan={2}>
<div className='label-column-right'>
@ -211,6 +208,10 @@ export default React.memo(styled(Bounty)(({ theme }: ThemeProps) => `
visibility: visible;
}
&.noBorder td {
border-bottom: 1px solid transparent;
}
.description-column {
max-width: 200px;

View File

@ -2,17 +2,14 @@
// SPDX-License-Identifier: Apache-2.0
import React, { useMemo, useRef, useState } from 'react';
import styled from 'styled-components';
import { DeriveCollectiveProposal } from '@polkadot/api-derive/types';
import { Button, Menu, Popup } from '@polkadot/react-components';
import { ThemeProps } from '@polkadot/react-components/types';
import { useMembers, useToggle } from '@polkadot/react-hooks';
import { BlockNumber, BountyIndex, BountyStatus } from '@polkadot/types/interfaces';
import { determineUnassignCuratorAction } from '../helpers';
import { useBountyStatus, useUserRole } from '../hooks';
import { bountySvgColor } from '../theme';
import { useTranslation } from '../translate';
import { ValidUnassignCuratorAction } from '../types';
import BountyRejectCurator from './BountyRejectCurator';
@ -117,7 +114,6 @@ function Index ({ bestNumber, className, description, index, proposals, status }
onClose={togglePopupOpen}
trigger={
<Button
className='settings-button'
dataTestId='extra-actions'
icon='ellipsis-v'
onClick={togglePopupOpen}
@ -177,21 +173,4 @@ function Index ({ bestNumber, className, description, index, proposals, status }
: null;
}
export default React.memo(styled(Index)(({ theme }: ThemeProps) => `
&& .ui--Button:not(.isDisabled):not(.isIcon).settings-button {
width: 24px;
height: 24px;
padding: 0;
border-radius: 4px;
svg {
padding: 0;
margin: 0;
color: ${bountySvgColor[theme.theme]};
}
&:focus {
border: 1px solid #616161;
}
}
`));
export default React.memo(Index);

View File

@ -2,10 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
import React, { useRef } from 'react';
import styled from 'styled-components';
import { Tabs } from '@polkadot/react-components';
import { ThemeProps } from '@polkadot/react-components/types';
import Bounties from './Bounties';
import { useTranslation } from './translate';
@ -41,67 +39,4 @@ function BountiesApp ({ basePath, className = '' }: Props): React.ReactElement<P
);
}
export default React.memo(styled(BountiesApp)(({ theme }: ThemeProps) => `
&& thead th {
padding: 0.75rem 1rem 0.57rem;
font-weight: bold;
font-size: 0.7rem;
line-height: 0.85rem;
text-transform: uppercase;
color: ${theme.colorLabel};
border: none;
}
thead tr {
border: none;
background: none;
}
tbody td {
padding: 1.4rem 1rem;
vertical-align: baseline;
font-size: 1rem;
line-height: 1.7rem;
}
tbody tr {
&.noBorder td {
border-bottom: 1px solid transparent;
}
&:nth-child(even) td {
padding: 0 1rem 1.4rem;
}
&:nth-child(odd) td {
vertical-align: middle;
}
&:first-child {
td {
border-top: 1px solid ${theme.borderTable};
}
td:first-child {
border-top-left-radius: 0.285rem;
}
td:last-child {
border-top-right-radius: 0.285rem;
}
}
&:last-child {
td {
border-bottom: 1px solid ${theme.borderTable};
}
td:first-child {
border-bottom-left-radius: 0.285rem;
}
td:last-child {
border-bottom-right-radius: 0.285rem;
}
}
}
`));
export default React.memo(BountiesApp);

View File

@ -15,10 +15,9 @@ interface Props {
filter?: React.ReactNode;
header?: (null | undefined | HeaderDef)[];
isEmpty: boolean;
hasTitle: boolean;
}
function Head ({ className = '', filter, hasTitle, header, isEmpty }: Props): React.ReactElement<Props> | null {
function Head ({ className = '', filter, header, isEmpty }: Props): React.ReactElement<Props> | null {
if (!header?.length) {
return null;
}
@ -38,7 +37,7 @@ function Head ({ className = '', filter, hasTitle, header, isEmpty }: Props): Re
key={index}
onClick={onClick}
>
{index === 0 && hasTitle
{index === 0
? (
<h1>
<Icon

View File

@ -16,7 +16,6 @@ interface TableProps {
filter?: React.ReactNode;
footer?: React.ReactNode;
header?: [React.ReactNode?, string?, number?, (() => void)?][];
hasTitle: boolean;
isFixed?: boolean;
legend?: React.ReactNode;
}
@ -32,7 +31,7 @@ function extractKids (children: React.ReactNode): [boolean, React.ReactNode] {
return [isEmpty, isEmpty ? null : kids];
}
function Table ({ children, className = '', empty, emptySpinner, filter, footer, hasTitle = true, header, isFixed, legend }: TableProps): React.ReactElement<TableProps> {
function Table ({ children, className = '', empty, emptySpinner, filter, footer, header, isFixed, legend }: TableProps): React.ReactElement<TableProps> {
const [isEmpty, kids] = extractKids(children);
return (
@ -41,7 +40,6 @@ function Table ({ children, className = '', empty, emptySpinner, filter, footer,
<table className={`${(isFixed && !isEmpty) ? 'isFixed' : 'isNotFixed'} highlight--bg-faint`}>
<Head
filter={filter}
hasTitle={hasTitle}
header={header}
isEmpty={isEmpty}
/>