-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #850 from contiamo/feature/contact
**Feature:** Add `Contact` component to for user metadata
- Loading branch information
Showing
8 changed files
with
184 additions
and
16 deletions.
There are no files selected for viewing
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,40 @@ | ||
import * as React from "react" | ||
|
||
import styled from "../utils/styled" | ||
|
||
export interface ContactProps { | ||
name: string | ||
meta?: string | ||
} | ||
|
||
const Container = styled("div")` | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
width: 100%; | ||
overflow: auto hidden; | ||
` | ||
|
||
const Heading = styled("h6")<{ hasMeta: boolean }>` | ||
margin: 0 0 ${({ theme, hasMeta }) => (hasMeta ? theme.space.base : 0)}px 0; | ||
font-size: ${({ theme }) => theme.font.size.small}px; | ||
font-weight: ${({ theme }) => theme.font.weight.medium}; | ||
color: ${({ theme }) => theme.color.text.dark}; | ||
line-height: 1; | ||
` | ||
|
||
const Meta = styled("p")` | ||
margin: 0; | ||
font-size: ${({ theme }) => theme.font.size.fineprint}px; | ||
color: ${({ theme }) => theme.color.text.lightest}; | ||
line-height: 1; | ||
` | ||
|
||
const Contact: React.SFC<ContactProps> = ({ name, meta, ...props }) => ( | ||
<Container {...props}> | ||
<Heading hasMeta={Boolean(meta)}>{name}</Heading> | ||
<Meta>{meta}</Meta> | ||
</Container> | ||
) | ||
|
||
export default Contact |
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,25 @@ | ||
Sometimes, we'd like to show someone's name and email address. This component lets us show a contact in a consistent way. | ||
|
||
## Basic Usage | ||
|
||
```jsx | ||
<> | ||
<Contact name="Luke Cage" meta="harlems.hero@gmail.com" /> | ||
<br /> | ||
<Contact name="Danny Rand" /> | ||
<br /> | ||
<Contact name="Matt Murdock" meta="+1 173 712 9124" /> | ||
</> | ||
``` | ||
|
||
## With Avatar | ||
|
||
In some cases, this component will be required to pair with an `Avatar`. Consider, | ||
|
||
```jsx | ||
initialState = { name: "Kenye Wheelest", email: "kweezy@notformidablelabs.com" } | ||
;<div style={{ display: "flex" }}> | ||
<Avatar style={{ marginRight: 8 }} name={state.name} /> | ||
<Contact name={state.name} meta={state.email} /> | ||
</div> | ||
``` |
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
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
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