-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor logic for HEAR multi-item incentive names (#188)
## Description This is what I was talking about in #187. It ended up being more involved than I thought, because Jest couldn't handle the JSX in the file `projects.tsx`. I tried other values of the `jsx` setting in tsconfig.json, but then Jest couldn't handle the magical `jsx:...` imports in projects.tsx (understandable; that's done using Parcel magic). So I factored out the icons from projects.tsx into a new file, and now the unit test works fine. ## Test Plan `yarn test`. The unit test is unmodified but still passes. Look at RI's HEAR incentive for stoves/dryers, and make sure it shows up and has the correct headline. Make sure the icons in the projects dropdown are correct. The one in the dropdown button should be purple, and in the menu should be grey-700 (i.e. almost black).
- Loading branch information
Showing
5 changed files
with
43 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import BatteryIcon from 'jsx:../static/icons/battery.svg'; | ||
import ClothesDryerIcon from 'jsx:../static/icons/clothes-dryer.svg'; | ||
import CookingIcon from 'jsx:../static/icons/cooking.svg'; | ||
import ElectricalWiringIcon from 'jsx:../static/icons/electrical-wiring.svg'; | ||
import EvIcon from 'jsx:../static/icons/ev.svg'; | ||
import HvacIcon from 'jsx:../static/icons/hvac.svg'; | ||
import LawnMowerIcon from 'jsx:../static/icons/lawnmower.svg'; | ||
import SolarIcon from 'jsx:../static/icons/solar.svg'; | ||
import WaterHeaterIcon from 'jsx:../static/icons/water-heater.svg'; | ||
import WeatherizationIcon from 'jsx:../static/icons/weatherization.svg'; | ||
import { Project } from './projects'; | ||
|
||
export const PROJECT_ICONS: { [p in Project]: () => React.ReactElement } = { | ||
clothes_dryer: () => <ClothesDryerIcon width="1em" />, | ||
hvac: () => <HvacIcon width="1em" />, | ||
ev: () => <EvIcon width="1em" />, | ||
solar: () => <SolarIcon width="1em" />, | ||
battery: () => <BatteryIcon width="1em" />, | ||
water_heater: () => <WaterHeaterIcon width="1em" />, | ||
cooking: () => <CookingIcon width="1em" />, | ||
wiring: () => <ElectricalWiringIcon width="1em" />, | ||
weatherization_and_efficiency: () => <WeatherizationIcon width="1em" />, | ||
lawn_care: () => <LawnMowerIcon width="1em" />, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.