feat(base): TERTIARY type rework
This commit is contained in:
parent
0d50f1867d
commit
ba3cd53017
|
@ -1,6 +1,10 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Button as NativePaperButton } from 'react-native-paper';
|
import {
|
||||||
|
Button as NativePaperButton,
|
||||||
|
Text,
|
||||||
|
TouchableRipple
|
||||||
|
} from 'react-native-paper';
|
||||||
|
|
||||||
import BaseTheme from '../../../ui/components/BaseTheme.native';
|
import BaseTheme from '../../../ui/components/BaseTheme.native';
|
||||||
import styles from './styles';
|
import styles from './styles';
|
||||||
|
@ -20,7 +24,7 @@ const Button: React.FC<ButtonProps> = ({
|
||||||
type
|
type
|
||||||
}: ButtonProps) => {
|
}: ButtonProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { CONTAINED, TEXT } = BUTTON_MODES;
|
const { CONTAINED } = BUTTON_MODES;
|
||||||
const { DESTRUCTIVE, PRIMARY, SECONDARY, TERTIARY } = BUTTON_TYPES;
|
const { DESTRUCTIVE, PRIMARY, SECONDARY, TERTIARY } = BUTTON_TYPES;
|
||||||
|
|
||||||
let buttonLabelStyles;
|
let buttonLabelStyles;
|
||||||
|
@ -40,10 +44,7 @@ const Button: React.FC<ButtonProps> = ({
|
||||||
color = BaseTheme.palette.actionDanger;
|
color = BaseTheme.palette.actionDanger;
|
||||||
buttonLabelStyles = styles.buttonLabelDestructive;
|
buttonLabelStyles = styles.buttonLabelDestructive;
|
||||||
mode = CONTAINED
|
mode = CONTAINED
|
||||||
} else if ( type === TERTIARY) {
|
} else {
|
||||||
buttonLabelStyles = styles.buttonLabelTertiary
|
|
||||||
mode = TEXT
|
|
||||||
} else {
|
|
||||||
color = buttonColor;
|
color = buttonColor;
|
||||||
buttonLabelStyles = styles.buttonLabel;
|
buttonLabelStyles = styles.buttonLabel;
|
||||||
}
|
}
|
||||||
|
@ -55,6 +56,26 @@ const Button: React.FC<ButtonProps> = ({
|
||||||
buttonStyles = styles.button;
|
buttonStyles = styles.button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( type === TERTIARY) {
|
||||||
|
return (
|
||||||
|
<TouchableRipple
|
||||||
|
accessibilityLabel = { accessibilityLabel }
|
||||||
|
disabled = { disabled }
|
||||||
|
onPress = { onPress }
|
||||||
|
rippleColor = 'transparent'
|
||||||
|
style = { [
|
||||||
|
buttonStyles,
|
||||||
|
style
|
||||||
|
] }>
|
||||||
|
<Text
|
||||||
|
style = { [
|
||||||
|
buttonLabelStyles,
|
||||||
|
labelStyle
|
||||||
|
] }>{ t(label) }</Text>
|
||||||
|
</TouchableRipple>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NativePaperButton
|
<NativePaperButton
|
||||||
accessibilityLabel = { t(accessibilityLabel) }
|
accessibilityLabel = { t(accessibilityLabel) }
|
||||||
|
|
|
@ -20,6 +20,5 @@ export const BUTTON_TYPES = {
|
||||||
* The modes of the buttons.
|
* The modes of the buttons.
|
||||||
*/
|
*/
|
||||||
export const BUTTON_MODES = {
|
export const BUTTON_MODES = {
|
||||||
CONTAINED: 'contained',
|
CONTAINED: 'contained'
|
||||||
TEXT: 'text'
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,7 +23,7 @@ const AutoAssignButton = () => {
|
||||||
label = 'breakoutRooms.actions.autoAssign'
|
label = 'breakoutRooms.actions.autoAssign'
|
||||||
labelStyle = { styles.autoAssignLabel }
|
labelStyle = { styles.autoAssignLabel }
|
||||||
onPress = { onAutoAssign }
|
onPress = { onAutoAssign }
|
||||||
style = { styles.transparentButton }
|
style = { styles.autoAssignButton }
|
||||||
type = { BUTTON_TYPES.TERTIARY } />
|
type = { BUTTON_TYPES.TERTIARY } />
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -66,10 +66,6 @@ export default {
|
||||||
marginLeft: BaseTheme.spacing[2]
|
marginLeft: BaseTheme.spacing[2]
|
||||||
},
|
},
|
||||||
|
|
||||||
transparentButton: {
|
|
||||||
marginTop: BaseTheme.spacing[3]
|
|
||||||
},
|
|
||||||
|
|
||||||
leaveButtonLabel: {
|
leaveButtonLabel: {
|
||||||
...baseLabel,
|
...baseLabel,
|
||||||
color: BaseTheme.palette.textError
|
color: BaseTheme.palette.textError
|
||||||
|
@ -77,5 +73,11 @@ export default {
|
||||||
|
|
||||||
autoAssignLabel: {
|
autoAssignLabel: {
|
||||||
color: BaseTheme.palette.link01
|
color: BaseTheme.palette.link01
|
||||||
|
},
|
||||||
|
|
||||||
|
autoAssignButton: {
|
||||||
|
alignSelf: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
marginTop: BaseTheme.spacing[3]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue