mymeta aboutme (#100)

* About Me component

* ...

* fix player about-me section to not be its own file

* About Me component

* Remove empty file

* Remove H1 in About Me

Co-authored-by: Hammad Jutt <jutt@ualberta.ca>
This commit is contained in:
Max Jackson
2020-08-26 23:09:14 -04:00
committed by GitHub
parent 6a569429d9
commit 0987ee1960
4 changed files with 25 additions and 7 deletions

View File

@@ -38,4 +38,5 @@ export { MetaHeading } from './MetaHeading';
export { MetaButton } from './MetaButton';
export { MetaBox } from './MetaBox';
export { MetaTag } from './MetaTag';
export { H1, P } from './typography';
export { ResponsiveText } from './ResponsiveText';

View File

@@ -0,0 +1,16 @@
import { Text } from '@chakra-ui/core';
import React from 'react';
export type TextProps = {
children: React.ReactNode;
};
const H1: React.FC<TextProps> = ({ children }) => (
<Text fontFamily="body" fontSize="2xl" fontWeight="bold" mb={4}>
{children}
</Text>
);
const P: React.FC<TextProps> = ({ children }) => <Text>{children}</Text>;
export { H1, P };

View File

@@ -2,6 +2,7 @@ import {
Container,
MetaBox,
MetaTag,
P,
SimpleGrid,
Text,
Wrap,
@@ -17,6 +18,7 @@ import {
} from 'next';
import Error from 'next/error';
import React from 'react';
import { getPlayerDescription } from 'utils/playerHelpers';
type Props = InferGetStaticPropsType<typeof getStaticProps>;
@@ -25,19 +27,15 @@ const PlayerPage: React.FC<Props> = ({ player }) => {
return <Error statusCode={404} />;
}
const aboutMeText = player.box_profile?.description;
return (
<>
<PlayerHero player={player} />
<PlayerFeatures player={player} />
<Container maxW="xl">
<SimpleGrid columns={[1, 1, 2, 3]} spacing="8" pt="12">
{aboutMeText ? (
<MetaBox title="About me">
<Text fontFamily="body">{player.box_profile?.description}</Text>
</MetaBox>
) : null}
<MetaBox title="About me">
<P>{getPlayerDescription(player)}</P>
</MetaBox>
<MetaBox title="Skills">
<Text fontFamily="body" color="whiteAlpha.500">
Unavailable

View File

@@ -6,3 +6,6 @@ export const getPlayerImage = (player: PlayerFragmentFragment): string =>
export const getPlayerName = (player: PlayerFragmentFragment): string =>
player.box_profile?.name || player.username;
export const getPlayerDescription = (player: PlayerFragmentFragment): string =>
player.box_profile?.description || '';