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

31 lines
722 B
JavaScript
Raw Normal View History

2021-07-17 20:39:16 +05:00
import React from 'react';
2021-07-09 12:15:06 +05:00
import {View} from 'react-native';
import {useTracked} from '../../provider';
2020-11-04 17:35:24 +05:00
import Heading from '../Typography/Heading';
2020-05-10 22:17:14 +05:00
2021-07-17 20:39:16 +05:00
export const Title = ({heading, headerColor}) => {
2020-11-04 17:35:24 +05:00
const [state] = useTracked();
2021-01-12 22:05:28 +05:00
const {colors} = state;
2021-07-09 12:15:06 +05:00
2020-05-10 22:17:14 +05:00
return (
2021-07-09 12:15:06 +05:00
<View
2020-11-10 17:16:06 +05:00
style={{
2021-07-09 12:15:06 +05:00
opacity: 1,
flexShrink: 1,
flexDirection: 'row',
2020-11-10 17:16:06 +05:00
}}>
2021-07-09 12:15:06 +05:00
<Heading
numberOfLines={1}
style={{
flexWrap: 'wrap',
}}
color={headerColor}>
2020-11-20 01:23:05 +05:00
<Heading color={colors.accent}>
2021-04-09 10:27:46 +05:00
{heading.slice(0, 1) === '#' ? '#' : null}
2020-11-20 01:23:05 +05:00
</Heading>
2021-07-09 12:15:06 +05:00
{heading.slice(0, 1) === '#' ? heading.slice(1) : heading}
2020-11-04 17:35:24 +05:00
</Heading>
2021-07-09 12:15:06 +05:00
</View>
2020-05-10 22:17:14 +05:00
);
};