Repository navigation
Expand file tree
/
Copy pathnav-header.tsx
More file actions
88 lines (82 loc) · 2.5 KB
/
Copy pathnav-header.tsx
File metadata and controls
88 lines (82 loc) · 2.5 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
import * as C from '@/constants'
import * as React from 'react'
import * as Kb from '@/common-adapters'
export const HeaderTitle = () => (
<Kb.Box2
direction="vertical"
alignItems="flex-start"
style={styles.headerTitle}
className="hover-underline-container"
>
<Kb.Text type="Header">Git repositories</Kb.Text>
<Kb.Text type="BodySmall">
All repositories are end-to-end encrypted.{' '}
<Kb.Text
type="BodySmall"
onClickURL="https://keybase.io/blog/encrypted-git-for-everyone"
style={styles.headerTitleLink}
className="hover-underline-child"
>
Read how it works.
</Kb.Text>
</Kb.Text>
</Kb.Box2>
)
export const HeaderRightActions = () => {
const setError = C.useGitState(s => s.dispatch.setError)
const navigateAppend = C.useRouterState(s => s.dispatch.navigateAppend)
const makePopup = React.useCallback(
(p: Kb.Popup2Parms) => {
const {attachTo, hidePopup} = p
const onAddPersonal = () => {
setError(undefined)
navigateAppend({props: {isTeam: false}, selected: 'gitNewRepo'})
}
const onAddTeam = () => {
setError(undefined)
navigateAppend({props: {isTeam: true}, selected: 'gitNewRepo'})
}
return (
<Kb.FloatingMenu
attachTo={attachTo}
closeOnSelect={true}
visible={true}
onHidden={hidePopup}
position="bottom center"
items={[
{icon: 'iconfont-person', onClick: onAddPersonal, title: 'New personal repository'},
{icon: 'iconfont-people', onClick: onAddTeam, title: 'New team repository'},
]}
/>
)
},
[navigateAppend, setError]
)
const {showPopup, popup, popupAnchor} = Kb.usePopup2(makePopup)
return (
<>
<Kb.Button
label="New repository"
onClick={showPopup}
small={true}
ref={popupAnchor}
style={styles.newRepoButton}
/>
{popup}
</>
)
}
const styles = Kb.Styles.styleSheetCreate(() => ({
headerTitle: {
flex: 1,
paddingBottom: Kb.Styles.globalMargins.xtiny,
paddingLeft: Kb.Styles.globalMargins.xsmall,
},
headerTitleLink: Kb.Styles.platformStyles({
isElectron: {...Kb.Styles.desktopStyles.windowDraggingClickable, cursor: 'pointer'},
}),
newRepoButton: Kb.Styles.platformStyles({
common: {alignSelf: 'flex-end', marginBottom: 6, marginRight: Kb.Styles.globalMargins.xsmall},
isElectron: Kb.Styles.desktopStyles.windowDraggingClickable,
}),
}))