|
8 | 8 | DEFAULT_OPTIONS, |
9 | 9 | APOD_OPTIONS, |
10 | 10 | TODAY_LIMIT_COUNT, |
| 11 | + TODAY_LIMIT, |
11 | 12 | } from '../../constants'; |
12 | 13 | import { getChrome, setChrome } from '../../utilities'; |
13 | 14 | import { |
@@ -42,7 +43,8 @@ const optionsConfig = [ |
42 | 43 | { |
43 | 44 | id: IS_TODAY_LIMIT_ON, |
44 | 45 | label: 'Switch from Today to Random', |
45 | | - description: `Show today's APOD ${TODAY_LIMIT_COUNT} times and then will switch to random APOD's.`, |
| 46 | + description: `Show today's APOD multiple times and then will switch to random APOD's. |
| 47 | + Use the input below to set the limit.`, |
46 | 48 | type: 'checkbox', |
47 | 49 | }, |
48 | 50 | ]; |
@@ -74,24 +76,42 @@ const Popup = () => { |
74 | 76 | <SPopupContainer> |
75 | 77 | <h3>Options</h3> |
76 | 78 | <SOptionsContainer> |
77 | | - {optionsConfig.map((option) => { |
78 | | - return ( |
79 | | - <SOption key={option.id} className="option"> |
80 | | - <div className="info"> |
81 | | - <label htmlFor={option.id}>{option.label}</label> |
82 | | - <div className="sub-info">{option.description}</div> |
83 | | - </div> |
84 | | - <div className="inputs"> |
85 | | - <input |
86 | | - onChange={handleCheckboxChange} |
87 | | - type={option.type} |
88 | | - id={option.id} |
89 | | - checked={popupOptions[option.id]} |
90 | | - /> |
91 | | - </div> |
92 | | - </SOption> |
93 | | - ); |
94 | | - })} |
| 79 | + {optionsConfig.map((option) => ( |
| 80 | + <SOption key={option.id}> |
| 81 | + <div className="info"> |
| 82 | + <label htmlFor={option.id}>{option.label}</label> |
| 83 | + <div className="sub-info">{option.description}</div> |
| 84 | + </div> |
| 85 | + <div className="inputs"> |
| 86 | + <input |
| 87 | + onChange={handleCheckboxChange} |
| 88 | + type={option.type} |
| 89 | + id={option.id} |
| 90 | + checked={popupOptions[option.id]} |
| 91 | + /> |
| 92 | + </div> |
| 93 | + </SOption> |
| 94 | + ))} |
| 95 | + <SOption> |
| 96 | + <div className="info"> |
| 97 | + <label htmlFor={'today-count'}>Today Limit</label> |
| 98 | + <div className="sub-info"> |
| 99 | + The APOD for today will be shown this number of times before |
| 100 | + switching to random. |
| 101 | + </div> |
| 102 | + </div> |
| 103 | + <div className="inputs"> |
| 104 | + <input |
| 105 | + disabled={!popupOptions[IS_TODAY_LIMIT_ON]} |
| 106 | + onChange={(event) => { |
| 107 | + setChrome({ [TODAY_LIMIT]: +event.target.value }); |
| 108 | + }} |
| 109 | + defaultValue={popupOptions[TODAY_LIMIT]} |
| 110 | + type="number" |
| 111 | + id="today-count" |
| 112 | + /> |
| 113 | + </div> |
| 114 | + </SOption> |
95 | 115 | </SOptionsContainer> |
96 | 116 | <SAboutApod> |
97 | 117 | <p> |
|
0 commit comments