ghost-portal/packages/react-components/src/Table/Body.tsx
Jaco Greeff 33892a2e31
Nav re-imagined (#3422)
* Playthrough with top navigation

* Sycky, but navigation works...

* Adjust

* grouping

* It works, but is not great

* Cleanups

* Cleanups

* hover color

* Highlights

* Highlights, part 2

* Background to body

* Small adjustments (size, items)

* Localize Modal/route switching

* Remove light/full mode

* Flatter single-entry menus

* Adjustments for single-enrties (e.g. Kulupu)

* Display NodeInfo

* Misc

* Content & Tabs sizing

* Tab counters as bubbles

* Alignment

* Tabs styling

* Adjust font color to defaults

* Small tabs menu color adjustments

* ... the previous, again, adjusted

* Display Wiki/Github links

* ar motions

* Adjust Endpoints location

* Ensure content grows to available height

* Adjust tabs

* Menu background adjustment

* Adjust popup colors

* Adjust highlights

* Sligh breathing room

* Adaptive header background

* 2/3

* Adaptive is ok... for now.

* Back to black... erm, gray

* Lighten

* Touchups. Stop playin, it is ok...

* Sides readability

* Cleanups.

* Adjust.

* Overall adjustments (theme). Fix Tag yellow.

* Ok. Done.

* Ship it.
2020-08-20 17:50:30 +02:00

190 lines
3.3 KiB
TypeScript

// Copyright 2017-2020 @polkadot/react-components authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import React from 'react';
import styled from 'styled-components';
import { isString } from '@polkadot/util';
import Spinner from '../Spinner';
interface Props {
children?: React.ReactNode;
className?: string;
empty?: React.ReactNode | false;
emptySpinner?: React.ReactNode;
}
function Body ({ children, className = '', empty, emptySpinner }: Props): React.ReactElement<Props> {
return (
<tbody className={className}>
{children || (
<tr><td colSpan={100}>{
isString(empty)
? <div className='empty'>{empty}</div>
: empty || <Spinner label={emptySpinner} />
}</td></tr>
)}
</tbody>
);
}
export default React.memo(styled(Body)`
td {
padding: 0.75rem 1rem;
text-align: left;
vertical-align: middle;
&:first-child {
border-left: 1px solid #e4e6e8;
}
&:last-child {
border-right: 1px solid #e4e6e8;
}
label {
display: block !important;
white-space: nowrap;
}
div.empty {
opacity: 0.6;
padding: 0.25rem;
}
.ui--Spinner {
margin: 0 auto;
.text {
margin-bottom: 0;
}
}
&.address {
min-width: 11rem;
overflow-x: hidden;
}
&.badge {
padding: 0;
}
&.button {
padding: 0.5rem 0.25rem;
text-align: right;
white-space: nowrap;
> * {
vertical-align: middle;
}
}
&.combined {
border-top-width: 0;
}
&.hash {
font-family: monospace;
}
&.number {
text-align: right;
}
&.relative {
position: relative;
}
&.overflow {
max-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
&.together {
white-space: nowrap;
}
&.top {
vertical-align: top;
}
&.middle {
text-align: center;
}
&.mini {
padding: 0 !important;
width: fit-content;
white-space: normal;
> div {
margin-right: 0.75rem;
max-width: 3.8rem;
min-width: 3.8rem;
}
}
&.favorite .ui--Icon.isSelected {
color: darkorange;
}
.ui--Button-Group .ui--Button {
margin: 0;
}
}
tr {
&:nth-child(even) {
background: #faf8f6;
}
&:nth-child(odd) {
background: white;
}
&:first-child td {
border-top: 1px solid #e4e6e8;
}
&:last-child td {
border-bottom: 1px solid #e4e6e8;
}
&:first-child {
td:first-child {
border-top-left-radius: 0.25rem;
}
td:last-child {
border-top-right-radius: 0.25rem;
}
}
&:last-child {
td:first-child {
border-bottom-left-radius: 0.25rem;
}
td:last-child {
border-bottom-right-radius: 0.25rem;
}
}
&.transparent {
background: transparent;
}
.ui--Button:not(.isIcon):not(:hover) {
background: transparent !important;
box-shadow: none !important;
}
.ui.toggle.checkbox input:checked~.box:before,
.ui.toggle.checkbox input:checked~label:before {
background-color: #eee !important;
}
}
`);