-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
Copy pathWorkspacesSectionHeader.tsx
53 lines (50 loc) · 2 KB
/
WorkspacesSectionHeader.tsx
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
import React from 'react';
import {View} from 'react-native';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import {PressableWithFeedback} from '@components/Pressable';
import Text from '@components/Text';
import Tooltip from '@components/Tooltip';
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import interceptAnonymousUser from '@libs/interceptAnonymousUser';
import * as App from '@userActions/App';
import CONST from '@src/CONST';
function WorkspacesSectionHeader() {
const theme = useTheme();
const styles = useThemeStyles();
const {translate} = useLocalize();
return (
<View style={[styles.ph5, styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter, styles.mv2]}>
<View>
<Text
style={styles.label}
color={theme.textSupporting}
>
{translate('common.workspaces')}
</Text>
</View>
<Tooltip text={translate('workspace.new.newWorkspace')}>
<PressableWithFeedback
accessible={false}
role={CONST.ROLE.BUTTON}
onPress={() => {
interceptAnonymousUser(() => App.createWorkspaceWithPolicyDraftAndNavigateToIt());
}}
>
{({hovered}) => (
<Icon
src={Expensicons.Plus}
width={12}
height={12}
additionalStyles={[styles.buttonDefaultBG, styles.borderRadiusNormal, styles.p2, hovered && styles.buttonHoveredBG]}
fill={theme.icon}
/>
)}
</PressableWithFeedback>
</Tooltip>
</View>
);
}
export default WorkspacesSectionHeader;