stacker.news/components/usage-header.js

28 lines
659 B
JavaScript
Raw Normal View History

2022-06-24 15:38:00 +00:00
import { useRouter } from 'next/router'
2022-12-01 21:31:04 +00:00
import { Form, Select } from './form'
import { WHENS } from '../lib/constants'
2022-06-24 15:38:00 +00:00
export function UsageHeader () {
const router = useRouter()
2022-12-01 21:31:04 +00:00
2022-06-24 15:38:00 +00:00
return (
2022-12-01 21:31:04 +00:00
<Form
initial={{
when: router.query.when || 'day'
}}
>
<div className='text-muted font-weight-bold my-3 d-flex align-items-center'>
2023-07-09 17:37:12 +00:00
stacker analytics for
2022-12-01 21:31:04 +00:00
<Select
groupClassName='mb-0 ml-2'
className='w-auto'
name='when'
size='sm'
items={WHENS}
2023-07-09 17:37:12 +00:00
onChange={(formik, e) => router.push(`/stackers/${e.target.value}`)}
2022-12-01 21:31:04 +00:00
/>
</div>
</Form>
2022-06-24 15:38:00 +00:00
)
}