1import React, { useCallback } from 'react';
2import cn from 'classnames';
3import { Flex } from 'indigo-react';
5import { FooterTarget } from './Footer';
6import useBreakpoints from 'lib/useBreakpoints';
7import { MiniBackButton } from './MiniBackButton';
8import { useHistory } from 'store/history';
9import { NavHeaderTarget } from './NavHeader';
10import { noop } from 'lodash';
14 children: React.ReactNode;
19 header?: React.ReactNode;
22 rest?: React.HTMLAttributes<HTMLDivElement>;
25// View is a top-level component that all Views must render to inherit styling
33 header = React.Fragment,
38 const { reset }: any = useHistory();
39 const isMobile: boolean = useBreakpoints([true, false, false]);
40 const shouldInset = inset && !isMobile;
42 const insetPadding = cn({
47 const goBack = useCallback(() => pop(), [pop]);
49 const goLogout = reset;
51 const showBackButton = !!pop;
53 const Header = useCallback(
55 return showBackButton ? (
60 'flex-row-r justify-between pb5 align-center'
65 className="f5 gray4 underline mr2 pointer">
68 <Flex.Item as={NavHeaderTarget} />
71 <Flex.Item className={insetPadding} as={NavHeaderTarget} />
74 [goLogout, insetPadding, showBackButton]
87 'mw2 ph9-md ph10-lg': full,
95 style={{ width: '48px' }}
96 className={cn(insetPadding)}>
97 {showBackButton && !hideBack && (
112 'justify-between': !centered,
113 'justify-center': centered,
115 <Flex.Item className="pb5 ">
116 {header || <Header logout={goBack} />}
119 <Flex.Item as={FooterTarget} />
122 <Flex.Item style={{ width: '48px' }} />
127// View.Full is sugar for <View full /> to help with readability
128View.Full = function FullView(props: ViewProps) {
129 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