feat(client): ts-migrate client/src/components/helpers/** (#42593)
* refactor(client): convert toggle-button to TypeScript
* chore: rename Space to tsx
* refactor(client): convert space to TypeScript
* chore: rename SlimWidthRow to tsx
* refactor(client): slim-width-row to TypeScript
* chore: rename SkeletonSprite to ts
* fix: fixed typos and resolved paths
* chore: resolve path inconsistencies
* refactor(client): skelton-sprite to TypeScript
* chore: rename loader.test to tsx
* chore: add types for react-spinkit
* refactor(client): loader to TypeScript
* refactor(client): link to TypeScript
* refactor(client): image-loader to TypeScript
* refactor(client): full-width-row to TypeScript
* refactor(client): current-challenge-link to TypeScript
* refactor(client): button to TypeScript
* refactor(client): border-color-picker to TypeScript
* refactor(client): avatar-renderer to TypeScript
* chore: changed loadertest(snap) to ts
* chore: optional types added and cleaned files
* fix: args are now optional
* push small updates for Spacer component merge
* update snapshot
* remove type defs from deps
* Revert "remove type defs from deps"
This reverts commit 9f58bf3554
.
* correctly remove client type deps
* final push to remove from deps
Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
660c3b3440
commit
4b44bb37d9
24
client/src/components/helpers/spacer.tsx
Normal file
24
client/src/components/helpers/spacer.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import React from 'react';
|
||||
|
||||
interface SpacerProps {
|
||||
size: number;
|
||||
}
|
||||
|
||||
const styles = { padding: '15px 0', height: '1px' };
|
||||
|
||||
const Comp = ({ ...props }): JSX.Element => (
|
||||
<div className='spacer' style={styles} {...props} />
|
||||
);
|
||||
|
||||
const Spacer = ({ size = 1 }: SpacerProps): JSX.Element =>
|
||||
size === 1 ? (
|
||||
<Comp />
|
||||
) : (
|
||||
<>
|
||||
{Array.from(Array(size), (_, i) => (
|
||||
<Comp key={`spacer_${i}`} />
|
||||
))}
|
||||
</>
|
||||
);
|
||||
|
||||
export default Spacer;
|
Reference in New Issue
Block a user