ghost-portal/packages/react-components/src/Digits.tsx
Jaco 4929b1c6fd
Update headers for 2023 (#8665)
* Update headers for 2023

* Adjust env-config
2023-01-01 10:32:05 +02:00

47 lines
941 B
TypeScript

// Copyright 2017-2023 @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;
}
}
`);