stacker.news/components/usage-header.js

27 lines
650 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'
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'>
user analytics for
<Select
groupClassName='mb-0 ml-2'
className='w-auto'
name='when'
size='sm'
items={['day', 'week', 'month', 'year', 'forever']}
onChange={(formik, e) => router.push(`/users/${e.target.value}`)}
/>
</div>
</Form>
2022-06-24 15:38:00 +00:00
)
}