1import React, { useCallback } from 'react';
2import cn from 'classnames';
3import { Flex } from 'indigo-react';
5import Footer from './Footer';
6import useBreakpoints from 'lib/useBreakpoints';
7import MiniBackButton from './MiniBackButton';
8import { useHistory } from 'store/history';
9import NavHeader from './NavHeader';
11const EXPECT_LOGOUT_WHEN_POPPING_AT_DEPTH = 2;
13// View is a top-level component that all Views must render to inherit styling
22 const { size } = useHistory();
23 const isMobile = useBreakpoints([true, false, false]);
24 const shouldInset = inset && !isMobile;
26 const insetPadding = cn({
31 const goBack = useCallback(() => pop(), [pop]);
33 const goLogout = useCallback(() => pop(size - 1), [pop, size]);
35 const showBackButton = size > 1 && !!pop;
36 const backIsLogout = size === EXPECT_LOGOUT_WHEN_POPPING_AT_DEPTH;
38 const Header = useCallback(
40 return showBackButton ? (
43 className={cn(insetPadding, 'flex-row-r justify-between pb5')}>
47 className="f5 gray4 underline mr2 pointer">
50 <Flex.Item as={NavHeader.Target} />
53 <Flex.Item className={insetPadding} as={NavHeader.Target} />
56 [insetPadding, showBackButton]
68 'mw2 ph9-md ph10-lg': full,
76 style={{ width: '48px' }}
77 className={cn(insetPadding)}>
78 {showBackButton && !backIsLogout && (
88 <Flex.Item flex={1} as={Flex} col justify="between">
89 <Flex.Item className="pb5 ">
90 <Header logout={goBack} />
93 <Flex.Item as={Footer.Target} />
96 <Flex.Item style={{ width: '48px' }} />
101// View.Full is sugar for <View full /> to help with readability
102View.Full = function FullView(props) {
103 return <View full {...props} />;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list