forked from MetaMask/metamask-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButtonToggle.styles.ts
More file actions
39 lines (34 loc) · 1.02 KB
/
ButtonToggle.styles.ts
File metadata and controls
39 lines (34 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Third party dependencies.
import { StyleSheet, ViewStyle } from 'react-native';
// External dependencies.
import { Theme } from '../../../../util/theme/models';
// Internal dependencies.
import { ButtonToggleStyleSheetVars } from './ButtonToggle.types';
/**
* Style sheet function for ButtonToggle component.
*
* @param params Style sheet params.
* @param params.vars Inputs that the style sheet depends on.
* @returns StyleSheet object.
*/
const styleSheet = (params: {
theme: Theme;
vars: ButtonToggleStyleSheetVars;
}) => {
const { vars, theme } = params;
const { colors } = theme;
const { style, isActive, size } = vars;
const colorObj = colors.primary;
return StyleSheet.create({
base: Object.assign(
{
backgroundColor: isActive ? colorObj.muted : 'transparent',
borderWidth: 1,
borderColor: isActive ? colorObj.default : colors.border.default,
borderRadius: Number(size) / 2,
} as ViewStyle,
style,
) as ViewStyle,
});
};
export default styleSheet;