push small updates for Spacer component merge
This commit is contained in:
@ -8,7 +8,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
interface AvatarRendererProps {
|
interface AvatarRendererProps {
|
||||||
isDonating?: boolean;
|
isDonating?: boolean;
|
||||||
isTopContributor?: boolean;
|
isTopContributor?: boolean;
|
||||||
picture: unknown;
|
picture: string;
|
||||||
userName: string;
|
userName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,14 +19,12 @@ function AvatarRenderer({
|
|||||||
isTopContributor
|
isTopContributor
|
||||||
}: AvatarRendererProps): JSX.Element {
|
}: AvatarRendererProps): JSX.Element {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
const borderColor: string = borderColorPicker(isDonating, isTopContributor);
|
||||||
const borderColor: unknown = borderColorPicker(isDonating, isTopContributor);
|
|
||||||
const isPlaceHolderImage =
|
const isPlaceHolderImage =
|
||||||
/example.com|identicon.org/.test(picture as string) ||
|
/example.com|identicon.org/.test(picture) || picture === defaultUserImage;
|
||||||
picture === defaultUserImage;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`avatar-container ${borderColor as string}`}>
|
<div className={`avatar-container ${borderColor}`}>
|
||||||
{isPlaceHolderImage ? (
|
{isPlaceHolderImage ? (
|
||||||
<DefaultAvatar className='avatar default-avatar' />
|
<DefaultAvatar className='avatar default-avatar' />
|
||||||
) : (
|
) : (
|
||||||
|
@ -3,7 +3,7 @@ import React from 'react';
|
|||||||
import envData from '../../../../config/env.json';
|
import envData from '../../../../config/env.json';
|
||||||
|
|
||||||
interface EnvData {
|
interface EnvData {
|
||||||
apiLocation?: string;
|
apiLocation: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { apiLocation } = envData as EnvData;
|
const { apiLocation } = envData as EnvData;
|
||||||
@ -14,7 +14,7 @@ function CurrentChallengeLink({
|
|||||||
children,
|
children,
|
||||||
isLargeBtn
|
isLargeBtn
|
||||||
}: {
|
}: {
|
||||||
children?: React.ReactNode;
|
children?: JSX.ElementChildrenAttribute;
|
||||||
isLargeBtn?: boolean;
|
isLargeBtn?: boolean;
|
||||||
}): JSX.Element {
|
}): JSX.Element {
|
||||||
let classNames;
|
let classNames;
|
||||||
@ -24,10 +24,7 @@ function CurrentChallengeLink({
|
|||||||
classNames = 'btn btn-primary btn-block';
|
classNames = 'btn btn-primary btn-block';
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<a
|
<a className={classNames} href={`${apiLocation}${currentChallengeApi}`}>
|
||||||
className={classNames}
|
|
||||||
href={`${apiLocation as string}${currentChallengeApi}`}
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
|
@ -5,7 +5,7 @@ function FullWidthRow({
|
|||||||
children,
|
children,
|
||||||
className
|
className
|
||||||
}: {
|
}: {
|
||||||
children?: React.ReactNode;
|
children?: JSX.ElementChildrenAttribute;
|
||||||
className?: string;
|
className?: string;
|
||||||
}): JSX.Element {
|
}): JSX.Element {
|
||||||
return (
|
return (
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import React, { ReactNode } from 'react';
|
import React from 'react';
|
||||||
import { Link as GatsbyLink } from 'gatsby';
|
import { Link as GatsbyLink } from 'gatsby';
|
||||||
|
|
||||||
interface LinkProps {
|
interface LinkProps {
|
||||||
children?: ReactNode;
|
children?: JSX.ElementChildrenAttribute;
|
||||||
external?: boolean;
|
external?: boolean;
|
||||||
sameTab?: boolean;
|
sameTab?: boolean;
|
||||||
to: string;
|
to: string;
|
||||||
|
@ -2,6 +2,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import styles from './skeleton-styles';
|
import styles from './skeleton-styles';
|
||||||
|
|
||||||
|
// TODO: unsure about parameter typing
|
||||||
function SkeletonSprite({}: React.FC<
|
function SkeletonSprite({}: React.FC<
|
||||||
React.ComponentPropsWithoutRef<'svg'>
|
React.ComponentPropsWithoutRef<'svg'>
|
||||||
>): JSX.Element {
|
>): JSX.Element {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import React, { ReactNode } from 'react';
|
import React from 'react';
|
||||||
import { Row, Col } from '@freecodecamp/react-bootstrap';
|
import { Row, Col } from '@freecodecamp/react-bootstrap';
|
||||||
|
|
||||||
interface SlimWidthRowProps {
|
interface SlimWidthRowProps {
|
||||||
children: ReactNode;
|
children: JSX.ElementChildrenAttribute;
|
||||||
}
|
}
|
||||||
function SlimWidthRow({
|
function SlimWidthRow({
|
||||||
children,
|
children,
|
||||||
|
@ -6,18 +6,19 @@ interface SpacerProps {
|
|||||||
|
|
||||||
const styles = { padding: '15px 0', height: '1px' };
|
const styles = { padding: '15px 0', height: '1px' };
|
||||||
|
|
||||||
const Comp: React.FC = ({ ...props }) => (
|
const Comp = ({ ...props }): JSX.Element => (
|
||||||
<div className='spacer' style={styles} {...props} />
|
<div className='spacer' style={styles} {...props} />
|
||||||
);
|
);
|
||||||
|
|
||||||
const Spacer = ({ size = 1 }: SpacerProps): React.ReactNode =>
|
const Spacer = ({ size = 1 }: SpacerProps): JSX.Element =>
|
||||||
size === 1 ? (
|
size === 1 ? (
|
||||||
<Comp />
|
<Comp />
|
||||||
) : (
|
) : (
|
||||||
'#'
|
<>
|
||||||
.repeat(size)
|
{Array.from(Array(size), (_, i) => (
|
||||||
.split('')
|
<Comp key={`spacer_${i}`} />
|
||||||
.map((_, i) => <Comp key={`spacer_${i}`} />)
|
))}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
export default Spacer;
|
export default Spacer;
|
||||||
|
@ -29,7 +29,7 @@ export default function ToggleButton({
|
|||||||
value,
|
value,
|
||||||
onLabel = 'On',
|
onLabel = 'On',
|
||||||
offLabel = 'Off'
|
offLabel = 'Off'
|
||||||
}: ButtonProps): React.ReactNode {
|
}: ButtonProps): JSX.Element {
|
||||||
const checkIconStyle = {
|
const checkIconStyle = {
|
||||||
height: '15px',
|
height: '15px',
|
||||||
width: '20px'
|
width: '20px'
|
||||||
|
Reference in New Issue
Block a user