Add random names to locate rows

This commit is contained in:
Hristo Nedelkov 2023-11-21 12:09:21 +02:00
parent 4559cc6130
commit af38912954

View File

@ -1,5 +1,7 @@
import { Text } from '@status-im/components'
import { Stack, XStack } from 'tamagui'
import faker from 'faker';
type DataType = {
option: string
description: string
@ -8,6 +10,12 @@ interface RowProps {
data: DataType | undefined
index: number
}
function cutSentenceToRandomWords(sentence: string) {
const randomLength = Math.floor(Math.random() * 100) + 1
let words = sentence.split(' ')
let slicedWords = words.slice(0, randomLength)
return slicedWords.join(' ')
}
const TerminalRow = ({ data, index }: RowProps) => {
if (!data) {
@ -15,7 +23,12 @@ const TerminalRow = ({ data, index }: RowProps) => {
}
const { option, description } = data
const name: string = faker.name.findName();
const email: string = faker.internet.email();
return (
<XStack style={{ fontFamily: 'monospace' }}>
<Stack
@ -32,8 +45,8 @@ const TerminalRow = ({ data, index }: RowProps) => {
{index}
</Stack>
<Stack>
{new Date(Date.now()).getHours()}h:{new Date(Date.now()).getMinutes()}m:
{new Date(Date.now()).getSeconds()}s
{new Date(Date.now()).getHours()}:{new Date(Date.now()).getMinutes()}:
{new Date(Date.now()).getSeconds()}
</Stack>
<Stack
style={{
@ -41,16 +54,16 @@ const TerminalRow = ({ data, index }: RowProps) => {
marginRight: '20px',
marginLeft: '20px',
wordWrap: 'break-word',
maxWidth: '80%',
maxWidth: '89%',
height: '100%',
}}
>
{option} {description} Lorem ipsum dolor sit amet consectetur adipisicing elit. Quidem
{option} {randomName}{' '}
{cutSentenceToRandomWords(`
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quidem
nobis, numquam non rerum illo eligendi quaerat neque mollitia temporibus quam placeat
repellat asperiores veritatis officiis unde sed praesentium obcaecati nihil? Quasi, quae
eveniet cupiditate mollitia est facilis ea vero, aperiam dolore dolor doloribus labore
eveniet cupiditate mollitia est facilis ea vero, aperiam dolore dolor doloribus labore`)}
</Stack>
</XStack>
)