Skip to content

Commit

Permalink
refactor(wakeword): move checkmark to its own file
Browse files Browse the repository at this point in the history
  • Loading branch information
timmywil committed Jul 23, 2020
1 parent df69455 commit ea16f91
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
27 changes: 5 additions & 22 deletions src/components/Wakeword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,16 @@ import Card from './Card'
import { CopyButton } from './EditButtons'
import { MIN_DEFAULT_MEDIA_QUERY } from 'typography-breakpoint-constants'
import SVGIcon from './SVGIcon'
import WakewordCheckmark from './WakewordCheckmark'
import { capitalize } from 'lodash'
import { css } from '@emotion/core'
import { record } from 'spokestack/client'

// The uploader will not allow anything longer than 3 seconds.
// We can't use 3 seconds here though or it results in recordings with
// 3 seconds and some milliseconds.
const MAX_RECORD_TIME = 2.9

function Checkmark(props: React.SVGProps<SVGSVGElement>) {
return (
<svg
{...props}
width="75"
height="76"
viewBox="0 0 75 76"
xmlns="http://www.w3.org/2000/svg">
<path
d="M37.5,74.5 C57.9345357,74.5 74.5,57.9345357 74.5,37.5 C74.5,17.0654643 57.9345357,0.5 37.5,0.5 C17.0654643,0.5 0.5,17.0654643 0.5,37.5 C0.5,57.9345357 17.0654643,74.5 37.5,74.5 Z"
stroke="#2F5BEA"
fillRule="nonzero"
/>
<polygon
fill="#2F5BEA"
points="31.7897727 44.4247159 50.5823864 25.5894886 53.0965909 28.1036932 31.7897727 49.4105114 21.9034091 39.5241477 24.375 37.0099432"
/>
</svg>
)
}

interface Props {
numRecordings?: number
assistant: string
Expand Down Expand Up @@ -211,7 +194,7 @@ export default class Wakeword extends PureComponent<Props, State> {
)}
<div css={styles.steps}>
{[...Array(numRecordings)].map((_, i) => (
<Checkmark
<WakewordCheckmark
key={`wakeword-checkmark-${i}`}
css={[styles.check, recorded >= i + 1 && styles.checkFilled]}
/>
Expand Down
22 changes: 22 additions & 0 deletions src/components/WakewordCheckmark.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react'

export default function Checkmark(props: React.SVGProps<SVGSVGElement>) {
return (
<svg
{...props}
width="75"
height="76"
viewBox="0 0 75 76"
xmlns="http://www.w3.org/2000/svg">
<path
d="M37.5,74.5 C57.9345357,74.5 74.5,57.9345357 74.5,37.5 C74.5,17.0654643 57.9345357,0.5 37.5,0.5 C17.0654643,0.5 0.5,17.0654643 0.5,37.5 C0.5,57.9345357 17.0654643,74.5 37.5,74.5 Z"
stroke="#2F5BEA"
fillRule="nonzero"
/>
<polygon
fill="#2F5BEA"
points="31.7897727 44.4247159 50.5823864 25.5894886 53.0965909 28.1036932 31.7897727 49.4105114 21.9034091 39.5241477 24.375 37.0099432"
/>
</svg>
)
}

0 comments on commit ea16f91

Please sign in to comment.