diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2020-02-10 12:29:03 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2020-02-10 13:08:27 +0100 |
| commit | 6784cbf74e5dcab20e4eae0a6730d9f73178a085 (patch) | |
| tree | ac366cecbedf1b5053f1388f23a62c4b5e2e10d9 /gui/src/renderer/components/MultiButton.tsx | |
| parent | 8f2b7f644b9634c74df9362be4605652c7ccdfe8 (diff) | |
| download | mullvadvpn-6784cbf74e5dcab20e4eae0a6730d9f73178a085.tar.xz mullvadvpn-6784cbf74e5dcab20e4eae0a6730d9f73178a085.zip | |
Improve appearance of reconnect button
Diffstat (limited to 'gui/src/renderer/components/MultiButton.tsx')
| -rw-r--r-- | gui/src/renderer/components/MultiButton.tsx | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/gui/src/renderer/components/MultiButton.tsx b/gui/src/renderer/components/MultiButton.tsx new file mode 100644 index 0000000000..efd21ee9ca --- /dev/null +++ b/gui/src/renderer/components/MultiButton.tsx @@ -0,0 +1,49 @@ +import * as React from 'react'; +import { Component, Styles, Types, View } from 'reactxp'; + +const SIDE_BUTTON_WIDTH = 50; + +const styles = { + buttonRow: Styles.createViewStyle({ + flexDirection: 'row', + }), + mainButton: Styles.createViewStyle({ + flex: 1, + borderTopRightRadius: 0, + borderBottomRightRadius: 0, + }), + sideButton: Styles.createViewStyle({ + borderTopLeftRadius: 0, + borderBottomLeftRadius: 0, + width: SIDE_BUTTON_WIDTH, + alignItems: 'center', + marginLeft: 1, + }), +}; + +interface IProps { + mainButton: React.ComponentType<IMainButtonProps>; + sideButton: React.ComponentType<ISideButtonProps>; +} + +export interface IMainButtonProps { + textOffset: number; + style?: Types.StyleRuleSetRecursive<Types.ViewStyleRuleSet>; +} + +export interface ISideButtonProps { + style?: Types.StyleRuleSetRecursive<Types.ViewStyleRuleSet>; +} + +export class MultiButton extends Component<IProps> { + public render() { + const { mainButton: MainButton, sideButton: SideButton } = this.props; + + return ( + <View style={styles.buttonRow}> + <MainButton textOffset={SIDE_BUTTON_WIDTH} style={styles.mainButton} /> + <SideButton style={styles.sideButton} /> + </View> + ); + } +} |
