Skip to content

Instantly share code, notes, and snippets.

View Bviveksingh's full-sized avatar
🙂
Focusing

Vivek Singh Bisht Bviveksingh

🙂
Focusing
View GitHub Profile
@Bviveksingh
Bviveksingh / index.tsx
Created September 15, 2022 19:10
providing props to difficultLevel
{difficultyLevel === undefined && <DifficultyLevel setDifficultyLevel={setDifficulty}/>}
@Bviveksingh
Bviveksingh / index.tsx
Created September 15, 2022 19:08
definition of setTime
const setTime = (seconds: number) => {
setTimeInSeconds(seconds);
}
@Bviveksingh
Bviveksingh / index.tsx
Created September 15, 2022 19:06
definition of endTimerFunc
const endTimerFunc = () => {
setStartTimer(false);
setEndTimer(true);
}
@Bviveksingh
Bviveksingh / index.tsx
Created September 15, 2022 19:05
startTimer definition
const [startTimer, setStartTimer] = useState<boolean>(false);
@Bviveksingh
Bviveksingh / index.tsx
Created September 15, 2022 19:03
first line at main/index.tsx with props
{timeInSeconds as number > 0 ? <Timer timeInSeconds={timeInSeconds as number} startTimer={startTimer} endTimerFunc={endTimerFunc}/> : <Duration setTimeInSeconds={setTime}/>}
@Bviveksingh
Bviveksingh / difficultyLevel.tsx
Created September 15, 2022 18:55
definition of difficultyLevel component
import React, { FC } from 'react';
type difficultyLevelType = 0 | 1 | 2;
interface DifficultyLevelProps{
setDifficultyLevel: (value: difficultyLevelType) => void;
}
const DifficultyLevel : FC<DifficultyLevelProps> = ({
@Bviveksingh
Bviveksingh / duration.tsx
Created September 15, 2022 18:54
definition of duration component
import React, { FC } from 'react';
type timeInSecondsType = 60 | 120 | 180;
interface DurationProps{
setTimeInSeconds: (value: timeInSecondsType) => void;
}
const Duration : FC<DurationProps> = ({
setTimeInSeconds
@Bviveksingh
Bviveksingh / inputBox.tsx
Created September 15, 2022 18:53
definition of inputBox
import React, { ChangeEvent, FC } from 'react'
interface InputBoxProps{
value: string | undefined;
onChange: (e:ChangeEvent<HTMLInputElement>) => void;
}
const InputBox : FC<InputBoxProps> = ({
value,
@Bviveksingh
Bviveksingh / paragraph.tsx
Created September 15, 2022 18:51
definition of paragraph component
import React, { FC } from 'react';
import styles from './paragraph.module.css';
interface ParagraphProps{
value: any;
}
const Paragraph : FC<ParagraphProps> = ({
value
}) => {
@Bviveksingh
Bviveksingh / timer.tsx
Last active September 15, 2022 18:50
return expression for timer
return (
<div>
{startTimer ? readableFormat : 'Timer is set, type to trigger timer'}
</div>
)