-
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.
take out switchPanel to the shared and add it to header of Callpage
- Loading branch information
Showing
9 changed files
with
155 additions
and
65 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,47 @@ | ||
import React, { useState } from "react"; | ||
import styles from "./styles.module.css"; | ||
|
||
interface Props { | ||
oneSwitch: string; | ||
twoSwitch: string; | ||
style: Object; | ||
state: boolean; | ||
onClick: (stateSwitch: boolean) => void; | ||
} | ||
|
||
const SwitchPanel: React.FC<Props> = (props) => { | ||
const [displaySwitch, setDisplaySwitch] = useState(props.state); | ||
|
||
function clickRight() { | ||
props.onClick(true); | ||
setDisplaySwitch(true); | ||
} | ||
|
||
function clickLeft() { | ||
props.onClick(false); | ||
setDisplaySwitch(false); | ||
} | ||
|
||
return ( | ||
<div className={styles.switchPanel} style={props.style}> | ||
<div | ||
className={ | ||
displaySwitch ? styles.switch : styles.switch + " " + styles.active | ||
} | ||
onClick={clickLeft} | ||
> | ||
<img src={props.oneSwitch} alt="" /> | ||
</div> | ||
<div | ||
className={ | ||
displaySwitch ? styles.switch + " " + styles.active : styles.switch | ||
} | ||
onClick={clickRight} | ||
> | ||
<img src={props.twoSwitch} alt="" /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SwitchPanel; |
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,27 @@ | ||
.switchPanel { | ||
display: flex; | ||
padding: 3px; | ||
align-items: center; | ||
background: var(--white, #fff); | ||
box-shadow: 0px 0px 2px 0px #c5ccd5; | ||
} | ||
|
||
.switch { | ||
display: flex; | ||
flex: 1 1; | ||
aspect-ratio: 1 / 1; | ||
justify-content: center; | ||
align-items: center; | ||
border-radius: 50%; | ||
opacity: 0.5; | ||
} | ||
|
||
.switch:hover { | ||
cursor: pointer; | ||
} | ||
|
||
.switch.active { | ||
background: var(--grey-6, #f9fafe); | ||
box-shadow: 0px 0px 2px 0px #c5ccd5; | ||
opacity: 1; | ||
} |
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