From fd91e7b4eed15c0d3b6eed8d7be22c07ef70d9dd Mon Sep 17 00:00:00 2001 From: Tyler Tran Date: Tue, 24 Oct 2023 18:55:21 -0700 Subject: [PATCH 1/2] Converted the Switch.js to Switch.tsx --- src/components/common/{Switch.js => Switch.tsx} | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) rename src/components/common/{Switch.js => Switch.tsx} (87%) diff --git a/src/components/common/Switch.js b/src/components/common/Switch.tsx similarity index 87% rename from src/components/common/Switch.js rename to src/components/common/Switch.tsx index 918c3dfb..b3590762 100644 --- a/src/components/common/Switch.js +++ b/src/components/common/Switch.tsx @@ -10,7 +10,15 @@ import '../../styles/Switch.scss'; * @param {JSX} offImg (optional): (JSX) element to be displayed on switch body when set to "off" */ -const Switch = function (props) { +interface SwitchProps { + on: boolean; + onToggle: (on:boolean) => void; + onImg?: JSX.Element; + offImg?:JSX.Element; + +} + +const Switch = function (props: SwitchProps) { const [on, setOn] = useState(!props.on ? false : props.on); useEffect(() => { From 6feaeeb35e9864d9b1d18196846bb258e7d9b325 Mon Sep 17 00:00:00 2001 From: Tyler Tran Date: Wed, 25 Oct 2023 11:23:45 -0700 Subject: [PATCH 2/2] Fix a small bug in the merge conflict due to importing --- src/components/common/Switch.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/common/Switch.test.js b/src/components/common/Switch.test.js index 0d59390d..12a46b00 100644 --- a/src/components/common/Switch.test.js +++ b/src/components/common/Switch.test.js @@ -1,6 +1,6 @@ import { shallow } from 'enzyme'; import React from 'react'; -import Switch from './Switch.js'; +import Switch from './Switch.tsx'; const switchOnClass = '.switch-body.switch-on'; // there has to be a better way of doing this const switchCheckboxClass = '.switch-input';