generated from zourdyzou/react-typescript-croissant
-
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.
Added bitcoin price chart to fear greed index chart
- Loading branch information
Showing
11 changed files
with
146 additions
and
23 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
43 changes: 43 additions & 0 deletions
43
src/components/screens/atoms/show-bitcoin-correlation-switch.tsx
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,43 @@ | ||
import React from "react"; | ||
import { Switch, Tooltip } from "@material-ui/core"; | ||
import { makeStyles, Theme, withStyles } from "@material-ui/core/styles"; | ||
|
||
import { bitcoinOrange } from "@/components/screens/molecules/history-fear-greed-chart"; | ||
import { selectFearGreedIndex, setShowBitcoinCorrelation } from "@/features/fear-greed-index-slice"; | ||
import { useAppDispatch, useAppSelector } from "@/hooks/*"; | ||
|
||
const useStyles = makeStyles((theme: Theme) => ({ | ||
bitcoinCorrelationSwitch: { | ||
margin: "12px 12px 0 0", | ||
}, | ||
})); | ||
|
||
const CustomSwitch = withStyles({ | ||
switchBase: { | ||
"&$checked": { | ||
color: bitcoinOrange, | ||
}, | ||
"&$checked + $track": { | ||
backgroundColor: bitcoinOrange, | ||
}, | ||
}, | ||
checked: {}, | ||
track: {}, | ||
})(Switch); | ||
|
||
export const ShowBitcoinCorrelationSwitch: React.FC = () => { | ||
const classes = useStyles(); | ||
const dispatch = useAppDispatch(); | ||
|
||
const fearGreedIndex = useAppSelector(selectFearGreedIndex); | ||
|
||
return ( | ||
<Tooltip title={`${fearGreedIndex.showBitcoinCorrelation ? "Hide" : "Show"} Bitcoin Price`}> | ||
<CustomSwitch | ||
className={classes.bitcoinCorrelationSwitch} | ||
checked={fearGreedIndex.showBitcoinCorrelation} | ||
onChange={() => dispatch(setShowBitcoinCorrelation(!fearGreedIndex.showBitcoinCorrelation))} | ||
/> | ||
</Tooltip> | ||
); | ||
}; |
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
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
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
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