Skip to content

Commit

Permalink
feat(#28): add welcome page
Browse files Browse the repository at this point in the history
  • Loading branch information
notmedia committed Dec 7, 2022
1 parent 79b58dd commit 5abb2c9
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/app/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ export * from './info-label';
export * from './kbar';
export * from './menu';
export * from './buttons';
export * from './kbd';
8 changes: 0 additions & 8 deletions src/app/components/kbar/kbar.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,3 @@ export const StyledShortcutWrapper = styled('div', {
gridAutoFlow: 'column',
gap: '1px',
});

export const StyledKbd = styled('kbd', {
padding: '4px 6px',
background: 'rgba(0 0 0 / .1)',
borderRadius: '4px',
fontSize: 14,
margin: 0,
});
5 changes: 3 additions & 2 deletions src/app/components/kbar/kbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { ActionId, ActionImpl, KBarPortal, KBarResults, useMatches } from '@gete
import { Container } from '@nextui-org/react';
import React, { PropsWithChildren } from 'react';

import { Kbd } from '@components';

import {
StyledActionWrapper,
StyledGroupName,
StyledKBarAnimator,
StyledKBarPositioner,
StyledKBarSearch,
StyledKbd,
StyledResultItem,
StyledShortcutWrapper,
} from './kbar.styled';
Expand Down Expand Up @@ -84,7 +85,7 @@ const ResultItem = React.forwardRef(
{action.shortcut?.length ? (
<StyledShortcutWrapper>
{action.shortcut.map((shortcut) =>
makeOsRelatedShortcut(os, shortcut).map((sc) => <StyledKbd key={sc}>{sc}</StyledKbd>)
makeOsRelatedShortcut(os, shortcut).map((sc) => <Kbd key={sc}>{sc}</Kbd>)
)}
</StyledShortcutWrapper>
) : null}
Expand Down
1 change: 1 addition & 0 deletions src/app/components/kbd/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './kbd';
9 changes: 9 additions & 0 deletions src/app/components/kbd/kbd.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { styled } from '@nextui-org/react';

export const Kbd = styled('kbd', {
padding: '4px 6px',
background: 'rgba(0 0 0 / .1)',
borderRadius: '4px',
fontSize: 14,
margin: 0,
});
6 changes: 2 additions & 4 deletions src/app/pages/tabs-container/tabs-container.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Container, Text } from '@nextui-org/react';
import React from 'react';

import { Tab, Tabs } from '@components';
import { CollectionType, useTabsStore } from '@storage';

import { GrpcTabContainer } from './collection-types';
import { WelcomeContainer } from './welcome';

export const TabsContainer = (): JSX.Element => {
const { activeTabId, closeTab, activateTab, moveTab, tabs } = useTabsStore((store) => store);
Expand All @@ -27,8 +27,6 @@ export const TabsContainer = (): JSX.Element => {
{tabsContent}
</Tabs>
) : (
<Container display="flex" justify="center" alignItems="center">
<Text css={{ color: '$accents6', userSelect: 'none' }}>No tabs</Text>
</Container>
<WelcomeContainer />
);
};
1 change: 1 addition & 0 deletions src/app/pages/tabs-container/welcome/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './welcome-container';
55 changes: 55 additions & 0 deletions src/app/pages/tabs-container/welcome/welcome-container.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { Col, Container, Row, Spacer, Text } from '@nextui-org/react';
import React from 'react';

import { Kbd } from '@components';

const shortcuts = [
{
key: '⌘+K',
description: 'Open command bar',
},
{
key: '⌘+Shift+C',
description: 'Create new collection',
},
{
key: '⌘+Shift+S',
description: 'Synchronize collections',
},
{
key: '⌘+T',
description: 'New gRPC tab',
},
];

export const WelcomeContainer: React.FC = () => (
<Container
display="flex"
justify="center"
alignItems="center"
wrap="nowrap"
direction="row"
css={{ userSelect: 'none' }}
>
<Container gap={0} display="flex" css={{ width: 400 }}>
<Text size="$xl" css={{ color: '$accents9' }}>
Shortcuts
</Text>
<Spacer y={2} />
{shortcuts.map((shortcut) => (
<Row>
<Col>
<Text size="$sm" css={{ color: '$accents8' }}>
{shortcut.description}
</Text>
</Col>
<Spacer x={2} />
<Col>
<Kbd key={shortcut.key}>{shortcut.key}</Kbd>
</Col>
<Spacer y={1.5} />
</Row>
))}
</Container>
</Container>
);

0 comments on commit 5abb2c9

Please sign in to comment.