|
1 |
| -import { defaultBMREquation, defaultExerciseMultiplier } from '@lib/defaults' |
| 1 | +import { defaultBMREquation } from '@lib/defaults' |
2 | 2 | import { selectStyles } from '@styles/selects'
|
3 | 3 | import { calculateAndUpdateBMR } from '@utils/bmr-functions'
|
4 | 4 | import clsx from 'clsx'
|
5 |
| -import type { BMREquation, ExerciseMultiplier } from 'src/types' |
| 5 | +import type { BMREquation } from 'src/types' |
6 | 6 |
|
7 | 7 | export const BMRSelector = () => {
|
8 | 8 | const handleBMREquationChange = (event: React.ChangeEvent<HTMLSelectElement>) => {
|
9 | 9 | const equation: BMREquation = event.target.value as unknown as BMREquation
|
10 | 10 | calculateAndUpdateBMR({ equation })
|
11 | 11 | }
|
12 | 12 |
|
13 |
| - const handleExerciseMultiplierChange = (event: React.ChangeEvent<HTMLSelectElement>) => { |
14 |
| - const exerciseMultiplier = event.target.value as unknown as ExerciseMultiplier |
15 |
| - calculateAndUpdateBMR({ exerciseMultiplier }) |
16 |
| - } |
17 |
| - |
18 | 13 | return (
|
19 |
| - <div className='flex w-full flex-col gap-4'> |
20 |
| - <div> |
21 |
| - <label htmlFor='BMREquation' className='mb-2 block text-sm font-medium text-sky-900'> |
22 |
| - BMR equation |
23 |
| - </label> |
24 |
| - <select |
25 |
| - id='BMREquation' |
26 |
| - name='BMREquation' |
27 |
| - defaultValue={defaultBMREquation} |
28 |
| - onChange={handleBMREquationChange} |
29 |
| - className={bmrSelectStyles} |
30 |
| - > |
31 |
| - <option value='Mifflin St Jeor'>Mifflin St Jeor</option> |
32 |
| - <option value='Revised Harris-Benedict'>Revised Harris-Benedict</option> |
33 |
| - <option value='Katch-McArdle'>Katch-McArdle</option> |
34 |
| - </select> |
35 |
| - </div> |
36 |
| - <div> |
37 |
| - <label htmlFor='exerciseMultiplier' className='mb-2 block text-sm font-medium text-sky-900'> |
38 |
| - Exercise multiplier |
39 |
| - </label> |
40 |
| - <select |
41 |
| - id='exerciseMultiplier' |
42 |
| - name='exerciseMultiplier' |
43 |
| - defaultValue={defaultExerciseMultiplier} |
44 |
| - onChange={handleExerciseMultiplierChange} |
45 |
| - className={bmrSelectStyles} |
46 |
| - > |
47 |
| - <option value='Sedentary'>🥱 Sedentary</option> |
48 |
| - <option value='Lightly active'>🏃♂️ Lightly active</option> |
49 |
| - <option value='Moderately active'>💪 Moderately active</option> |
50 |
| - <option value='Very active'>🏋️♀️ Very active</option> |
51 |
| - <option value='Extremely active'>🔥 Extremely active</option> |
52 |
| - </select> |
53 |
| - </div> |
| 14 | + <div className='w-full'> |
| 15 | + <label htmlFor='BMREquation' className='mb-2 block text-sm font-medium text-amber-900'> |
| 16 | + BMR equation |
| 17 | + </label> |
| 18 | + <select |
| 19 | + id='BMREquation' |
| 20 | + name='BMREquation' |
| 21 | + defaultValue={defaultBMREquation} |
| 22 | + onChange={handleBMREquationChange} |
| 23 | + className={clsx(selectStyles, 'border-amber-300 bg-amber-50 text-amber-900 focus:border-amber-500 focus:ring-amber-500')} |
| 24 | + > |
| 25 | + <option value='Mifflin St Jeor'>Mifflin St Jeor</option> |
| 26 | + <option value='Revised Harris-Benedict'>Revised Harris-Benedict</option> |
| 27 | + <option value='Katch-McArdle'>Katch-McArdle</option> |
| 28 | + </select> |
54 | 29 | </div>
|
55 | 30 | )
|
56 | 31 | }
|
57 |
| - |
58 |
| -const bmrSelectStyles = clsx(selectStyles, 'border-sky-300 bg-sky-50 text-sky-900 focus:border-sky-500 focus:ring-sky-500') |
0 commit comments