This repository has been archived by the owner on Mar 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from Groww/develop
Develop
- Loading branch information
Showing
8 changed files
with
186 additions
and
64 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
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,48 @@ | ||
import React from 'react'; | ||
|
||
|
||
const Dialog = (props: Props) => { | ||
const animation = | ||
(props.animationType === 'enter' | ||
? props.enterAnimation | ||
: props.leaveAnimation) || props.animation; | ||
|
||
|
||
const className = `rodal-dialog rodal-${animation}-${props.animationType}`; | ||
|
||
const { width, height, duration, customStyles } = props; | ||
|
||
const style = { | ||
width: width, | ||
height: height, | ||
animationDuration: duration + 'ms', | ||
WebkitAnimationDuration: duration + 'ms' | ||
// borderTopLeftRadius: '7px', | ||
// borderTopRightRadius: '7px' | ||
}; | ||
|
||
const mergedStyles = { ...style, ...customStyles }; | ||
|
||
return ( | ||
<div style={mergedStyles} | ||
className={className} | ||
> | ||
{props.children} | ||
</div> | ||
); | ||
}; | ||
|
||
|
||
type Props = { | ||
animation: string; | ||
animationType: string; | ||
enterAnimation: string; | ||
leaveAnimation: string; | ||
width: number | string; | ||
height: number | string; | ||
duration: number; | ||
children: React.ReactNode; | ||
customStyles: React.CSSProperties; | ||
} | ||
|
||
export default Dialog; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React from 'react'; | ||
|
||
|
||
import './toggleSelection.css'; | ||
|
||
|
||
const ToggleSelection = (props: Props) => { | ||
const { leftText, rightText, isActive, onChange, parentClass } = props; | ||
|
||
const choiceClasses = 'fs16 fw500 fullWidth absolute-center tc341ChoiceClass '; | ||
const activeChoiceClasses = choiceClasses + 'clrGreen tc341ActiveChoice'; | ||
const inActiveChoiceClasses = choiceClasses + 'clrText tc341InactiveChoice'; | ||
|
||
const leftTextClasses = isActive ? activeChoiceClasses : inActiveChoiceClasses; | ||
const rightTextClasses = !isActive ? activeChoiceClasses : inActiveChoiceClasses; | ||
|
||
|
||
const changeChoice = (turnActive: boolean) => { | ||
if (onChange && (turnActive !== isActive)) { | ||
onChange(isActive); | ||
} | ||
}; | ||
|
||
|
||
return ( | ||
<div className={`valign-wrapper tc341ToggleWrapper ${parentClass}`}> | ||
<div | ||
className={leftTextClasses} | ||
onClick={() => changeChoice(true)} | ||
> | ||
{leftText} | ||
</div> | ||
|
||
<div className="tc341Divider"></div> | ||
|
||
<div | ||
className={rightTextClasses} | ||
onClick={() => changeChoice(false)} | ||
> | ||
{rightText} | ||
</div> | ||
</div> | ||
); | ||
|
||
}; | ||
|
||
|
||
const defaultProps: DefaultProps = { | ||
parentClass: '', | ||
leftText: 'En', | ||
rightText: 'हि', | ||
activeBackgroundColor: 'var(--primaryClr)', | ||
inactiveBackgroundColor: 'var(--subText)' | ||
}; | ||
|
||
|
||
type RequiredProps = { | ||
isActive: boolean; | ||
onChange: (isActive: boolean) => void; | ||
} | ||
|
||
|
||
type DefaultProps = { | ||
parentClass: string; | ||
leftText: React.ReactNode; | ||
rightText: React.ReactNode; | ||
activeBackgroundColor: string; | ||
inactiveBackgroundColor: string; | ||
} | ||
|
||
|
||
ToggleSelection.defaultProps = defaultProps; | ||
|
||
export type Props = RequiredProps & DefaultProps; | ||
|
||
export default ToggleSelection; |
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 @@ | ||
export { default as ToggleSelection } from './ToggleSelection'; |
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,26 @@ | ||
.tc341ToggleWrapper { | ||
width: 88px; | ||
height: 32px; | ||
border-radius: 30px; | ||
border: 1px solid var(--primaryClr); | ||
justify-content: space-evenly; | ||
overflow: hidden; | ||
} | ||
|
||
|
||
.tc341Divider { | ||
height: 100%; | ||
width: 1px; | ||
background-color: var(--primaryClr); | ||
z-index: var(--zindex300); | ||
} | ||
|
||
|
||
.tc341ActiveChoice { | ||
background-color: var(--primaryClr10); | ||
} | ||
|
||
|
||
.tc341ChoiceClass { | ||
height: 100%; | ||
} |