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
38 const { reset }: any = useHistory();
40 const isMobile: boolean = useBreakpoints([true, false, false]);
41 const shouldInset = inset && !isMobile;
43 const insetPadding = cn({
48 const goBack = useCallback(() => pop(), [pop]);
50 const goLogout = reset;
52 const showBackButton = !!pop;
54 const Header = useCallback(
56 return showBackButton ? (
61 'flex-row-r justify-between pb5 align-center'
66 className="f5 gray4 underline mr2 pointer">
69 <Flex.Item as={NavHeaderTarget} />
72 <Flex.Item className={insetPadding} as={NavHeaderTarget} />
75 [goLogout, insetPadding, showBackButton]
88 'mw2 ph9-md ph10-lg': full,
96 style={{ width: '48px' }}
97 className={cn(insetPadding)}>
98 {showBackButton && !hideBack && (
113 'justify-between': !centered,
114 'justify-center': centered,
116 <Flex.Item className="pb5 ">
117 {header || <Header logout={goBack} />}
120 <Flex.Item as={FooterTarget} />
123 <Flex.Item style={{ width: '48px' }} />
128// View.Full is sugar for <View full /> to help with readability
129View.Full = function FullView(props: ViewProps) {
130 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