-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(AuthorCard): Add profile info for main site authors (#163)
* Create Author Card * Add author card mdx * Remove no-var-requires tslint rule * small padding fix
- Loading branch information
Showing
13 changed files
with
493 additions
and
2,456 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
name: Author Card | ||
route: /authorcard | ||
--- | ||
|
||
import { Playground, PropsTable } from 'docz' | ||
import AuthorCard from '.' | ||
import authorImage from './author.png' | ||
|
||
# Author Card | ||
|
||
Every author needs a card. | ||
|
||
<PropsTable of={AuthorCard} /> | ||
|
||
<Playground> | ||
<AuthorCard | ||
name="Joe Bruin Long Name Here" | ||
position="Editor in Chief" | ||
image={authorImage} | ||
twitter="uclachancellor" | ||
email="[email protected]" | ||
/> | ||
</Playground> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
import * as React from 'react' | ||
import { css } from 'react-emotion' | ||
import * as MainSiteStyles from '../../globals/mainsiteGlobalStyles' | ||
import emailImage from './email.png' | ||
import twitterImage from './twitter.png' | ||
|
||
/** | ||
* Author Card properties. | ||
*/ | ||
interface AuthorCardProps { | ||
/** Link to image of author. */ | ||
image: string | ||
/** Author's full name. */ | ||
name: string | ||
/** Author's position/title. */ | ||
position: string | ||
/** Author's twitter handle e.g. "uclachancellor" */ | ||
twitter?: string | ||
/** Author's email address e.g. "[email protected]". */ | ||
email?: string | ||
} | ||
|
||
interface SocialCircleProps { | ||
url: string | ||
image: string | ||
} | ||
|
||
const SocialCircle: React.SFC<SocialCircleProps> = props => { | ||
return ( | ||
<a href={props.url}> | ||
<div | ||
className={css` | ||
background-color: ${MainSiteStyles.lightGray}; | ||
border-style: solid; | ||
border-width: 0.5px; | ||
border-radius: 50%; | ||
border-color: ${MainSiteStyles.gray}; | ||
height: 35px; | ||
width: 35px; | ||
margin: 5px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
`} | ||
> | ||
<img | ||
className={css` | ||
width: 70%; | ||
height: auto; | ||
`} | ||
src={props.image} | ||
/> | ||
</div> | ||
</a> | ||
) | ||
} | ||
|
||
/** An author card. */ | ||
export default class AuthorCard extends React.Component<AuthorCardProps> { | ||
public render() { | ||
return ( | ||
<div | ||
className={css` | ||
background-color: white; | ||
box-shadow: ${MainSiteStyles.cardShadow}; | ||
`} | ||
> | ||
<div | ||
className={css` | ||
height: 100%; | ||
display: block; | ||
`} | ||
> | ||
<div | ||
className={css` | ||
width: 80%; | ||
display: block; | ||
margin: auto; | ||
`} | ||
> | ||
<img | ||
className={css` | ||
border-radius: 50%; | ||
margin: auto; | ||
padding-top: 20px; | ||
width: 100%; | ||
height: auto; | ||
`} | ||
src={this.props.image} | ||
/> | ||
</div> | ||
<h1 | ||
className={css` | ||
font-style: 'bold'; | ||
font-size: 24px; | ||
line-height: 1.6rem; | ||
text-align: center; | ||
font-family: ${MainSiteStyles.headlineFont}; | ||
color: black; | ||
padding: 0px 20px 5px 20px; | ||
margin: 0px; | ||
`} | ||
> | ||
{this.props.name} | ||
</h1> | ||
<div | ||
className={css` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
`} | ||
> | ||
{this.props.twitter && ( | ||
<SocialCircle | ||
url={'https://twitter.com/' + this.props.twitter} | ||
image={twitterImage} | ||
/> | ||
)} | ||
{this.props.email && ( | ||
<SocialCircle | ||
url={'mailto:' + this.props.email} | ||
image={emailImage} | ||
/> | ||
)} | ||
</div> | ||
</div> | ||
<h3 | ||
className={css` | ||
text-transform: uppercase; | ||
text-align: center; | ||
color: white; | ||
background-color: black; | ||
padding: 4px 0px; | ||
line-height: 1.6rem; | ||
margin: 0px; | ||
`} | ||
> | ||
{this.props.position} | ||
</h3> | ||
</div> | ||
) | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.