Files
notesnook/apps/mobile/src/components/Header/HeaderTitle.js

34 lines
815 B
JavaScript
Raw Normal View History

2020-09-09 22:09:57 +05:00
import React from 'react';
2020-09-27 10:15:19 +05:00
import {Text} from 'react-native';
import {useTracked} from '../../provider';
2020-10-13 17:02:14 +05:00
import {SIZE, WEIGHT} from "../../utils/SizeUtils";
2020-05-10 22:17:14 +05:00
export const HeaderTitle = ({root}) => {
const [state, dispatch] = useTracked();
2020-09-27 10:15:19 +05:00
const {colors, headerTextState} = state;
const style = {
fontSize: SIZE.xl,
color: headerTextState.color || colors.heading,
fontFamily: WEIGHT.bold,
alignSelf: 'center',
};
2020-05-10 22:17:14 +05:00
return (
2020-09-09 22:09:57 +05:00
<>
2020-09-27 10:15:19 +05:00
<Text style={style}>
2020-09-09 22:09:57 +05:00
<Text
style={{
color: colors.accent,
}}>
{headerTextState.heading.slice(0, 1) === '#' ? '#' : null}
</Text>
2020-05-10 22:17:14 +05:00
2020-09-09 22:09:57 +05:00
{headerTextState.heading.slice(0, 1) === '#'
? headerTextState.heading.slice(1)
: headerTextState.heading}
</Text>
</>
2020-05-10 22:17:14 +05:00
);
};