-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cw|#63] implement speech bubble component, design welcome page, write
media queries for welcome page
- Loading branch information
connorwalsh
committed
Nov 23, 2018
1 parent
23efdb4
commit 867829c
Showing
5 changed files
with
201 additions
and
123 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react' | ||
import {range, reduce} from 'lodash' | ||
import {Animation} from './animate' | ||
|
||
|
||
// this component is for rendering animated speech bubbles which | ||
// are displayed character by character | ||
export const SpeechBubble = (props) => { | ||
const {text} = props | ||
|
||
// separate the text chars into individual and | ||
// cumulative frames! | ||
const frames = reduce( | ||
range(0, text.length), | ||
(acc, idx) => ([ | ||
...acc, | ||
idx === 0 ? | ||
text.charAt(idx) | ||
: `${acc[idx-1]}${text.charAt(idx)}`, | ||
]), | ||
[], | ||
) | ||
|
||
return ( | ||
<Animation frames={frames} | ||
{...props} | ||
/> | ||
) | ||
|
||
} |
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