summaryrefslogtreecommitdiffhomepage
path: root/gui/src/renderer/components/SettingsHeader.tsx
blob: 9ddfa171c25f11341d05c1a0a7863f5ad3e7bcfb (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import * as React from 'react';
import { Component, Styles, Text, Types, View } from 'reactxp';
import { colors } from '../../config.json';

const styles = {
  header: {
    default: Styles.createViewStyle({
      flex: 0,
      paddingTop: 4,
      paddingRight: 24,
      paddingLeft: 24,
      paddingBottom: 24,
    }),
  },
  title: Styles.createTextStyle({
    fontFamily: 'DINPro',
    fontSize: 32,
    fontWeight: '900',
    lineHeight: 36,
    color: colors.white,
  }),
  subtitle: Styles.createTextStyle({
    fontFamily: 'Open Sans',
    fontSize: 13,
    fontWeight: '600',
    overflow: 'visible',
    color: colors.white80,
    lineHeight: 20,
    letterSpacing: -0.2,
  }),
  spacer: Styles.createViewStyle({
    height: 8,
  }),
};

interface ISettingsHeaderProps {
  style?: Types.ViewStyleRuleSet;
}

interface ISettingsTextProps {
  style?: Types.TextStyleRuleSet;
}

export default class SettingsHeader extends Component<ISettingsHeaderProps> {
  public render() {
    return (
      <View style={[styles.header.default, this.props.style]}>
        {React.Children.map(this.props.children, (child, index) => {
          if (React.isValidElement(child) && index > 0) {
            return (
              <React.Fragment>
                <View style={styles.spacer} />
                {child}
              </React.Fragment>
            );
          } else {
            return child;
          }
        })}
      </View>
    );
  }
}

export class HeaderTitle extends Component<ISettingsTextProps> {
  public render() {
    return <Text style={[styles.title, this.props.style]}>{this.props.children}</Text>;
  }
}

export class HeaderSubTitle extends Component<ISettingsTextProps> {
  public render() {
    return <Text style={[styles.subtitle, this.props.style]}>{this.props.children}</Text>;
  }
}