ghost-portal/packages/react-components/src/Digits.tsx
Jaco Greeff af8b00750d
Select slot range via dropdown (#4845)
* Select slot range

* Formatting adjust

* Crowdload active/ended split

* Raised active cap

* Remove useFundIndexes

* Display leases for upcoming

* Formatting

* Correct header
2021-03-14 13:15:26 +01:00

47 lines
941 B
TypeScript

// Copyright 2017-2021 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0
import React from 'react';
import styled from 'styled-components';
interface Props {
className?: string;
value: string;
}
function Digits ({ className = '', value }: Props): React.ReactElement<Props> {
return (
<div className={className}>
{value.split(',').map((parts, index) => (
<div
className='group'
key={index}
>
{index !== 0 ? ',' : ''}
{parts.split('').map((d, index) => (
<div
className='digit'
key={index}
>{d}</div>
))}
</div>
))}
</div>
);
}
export default React.memo(styled(Digits)`
display: inline-block;
white-space: nowrap;
.group {
display: inline-block;
.digit {
display: inline-block;
text-align: center;
width: 1ch;
}
}
`);