내비게이션 시스템
내비게이션 시스템 (Navigation System)
내비게이션 시스템은 전역 탐색과 액션을 제공하는 레이아웃 컴포넌트 모음이에요. 상단 탐색바(TopNav), 사이드 내비게이션 토글, 그리고 다양한 탑 내비게이션 항목들을 포함한답니다.
출처: 문서
본문
TopNav 컴포넌트
가로형 상단 탐색바 컴포넌트예요.
- 키워드: navigation, top-nav, header
- 카테고리: navigation
- 상태: general-availability
예시
/**
* @jsxRuntime classic
* @jsx jsx
*/
import { jsx } from '@compiled/react';
import AKBadge from '@atlaskit/badge/badge';
import { cssMap } from '@atlaskit/css';
import AtlassianIntelligenceIcon from '@atlaskit/icon/core/atlassian-intelligence';
import SearchIcon from '@atlaskit/icon/core/search';
import { ConfluenceIcon } from '@atlaskit/logo/confluence-icon';
import { Root } from '@atlaskit/navigation-system/layout/root';
import { SideNavToggleButton } from '@atlaskit/navigation-system/layout/side-nav';
import {
TopNav,
TopNavEnd,
TopNavMiddle,
TopNavStart,
} from '@atlaskit/navigation-system/layout/top-nav';
import {
AppLogo,
AppSwitcher,
ChatButton,
CreateButton,
EndItem,
Help,
Profile,
Search,
Settings,
} from '@atlaskit/navigation-system/top-nav-items';
import { Notifications } from '@atlaskit/navigation-system/top-nav-items/notifications';
import { Flex } from '@atlaskit/primitives/compiled/flex';
import { token } from '@atlaskit/tokens';
import { WithResponsiveViewport } from './utils/example-utils';
import { MockSearch } from './utils/mock-search';
const iconSpacingStyles = cssMap({
space050: {
paddingBlock: token('space.050'),
paddingInline: token('space.050'),
},
});
const Badge = () => <AKBadge appearance="important">{5}</AKBadge>;
export const TopNavigationExample: () => JSX.Element = () => (
<WithResponsiveViewport>
{/**
* Wrapping in `Root to ensure the TopNav height is set correctly, as it would in a proper composed usage.
* Root sets the top bar height CSS variable that TopNav uses to set its height
*/}
<Root>
<TopNav>
<TopNavStart
sideNavToggleButton={
<SideNavToggleButton collapseLabel="Collapse sidebar" expandLabel="Expand sidebar" />
}
>
<AppSwitcher label="App switcher" onClick={() => alert('app switcher')} />
<AppLogo
href="http://www.atlassian.design"
icon={ConfluenceIcon}
name="Confluence"
label="Home page"
/>
</TopNavStart>
<TopNavMiddle>
<Search onClick={() => alert('mobile search')} label="Search" />
<CreateButton onClick={() => alert('create')}>Create</CreateButton>
</TopNavMiddle>
<TopNavEnd>
<ChatButton onClick={() => alert('chat')}>Chat</ChatButton>
<EndItem
icon={AtlassianIntelligenceIcon}
onClick={() => alert('inshelligence')}
label="Atlassian Intelligence"
/>
<Help onClick={() => alert('help')} label="Help" />
<Notifications
badge={Badge}
onClick={() => alert('notifications')}
label="Notifications"
/>
<Settings onClick={() => alert('settings')} label="Settings" />
<Profile onClick={() => alert('User settings')} label="Your profile" />
</TopNavEnd>
</TopNav>
</Root>
</WithResponsiveViewport>
);
export const SearchRightElem: () => JSX.Element = () => (
<WithResponsiveViewport>
<Root>
<TopNav>
<TopNavStart sideNavToggleButton={null}>
<AppSwitcher label="App switcher" onClick={() => alert('app switcher')} />
</TopNavStart>
<TopNavMiddle>
<Search
iconBefore={AtlassianIntelligenceIcon}
elemAfter={
<Flex xcss={iconSpacingStyles.space050}>
<SearchIcon color={token('color.icon')} label="" />
</Flex>
}
onClick={() => alert('mobile search')}
label="Search"
/>
<CreateButton onClick={() => alert('create')}>Create</CreateButton>
</TopNavMiddle>
<TopNavEnd>
<Settings onClick={() => alert('settings')} label="Settings" />
</TopNavEnd>
</TopNav>
</Root>
</WithResponsiveViewport>
);
export const TopNavigationEnlargedSearchInput: () => JSX.Element = () => (
<WithResponsiveViewport>
<Root>
<TopNav>
<TopNavStart sideNavToggleButton={null}>
<AppSwitcher label="App switcher" onClick={() => alert('app switcher')} />
</TopNavStart>
<div>
<TopNavMiddle>
<MockSearch isEnlarged />
<CreateButton onClick={() => alert('create')}>Create</CreateButton>
</TopNavMiddle>
</div>
<TopNavEnd>
<Settings onClick={() => alert('settings')} label="Settings" />
</TopNavEnd>
</TopNav>
</Root>
</WithResponsiveViewport>
);
export default TopNavigationExample;
Props
| Prop | Type | Description |
|---|---|---|
children |
string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal |
The content of the layout area (required) |
customTheme |
{ backgroundColor: string | RGB; highlightColor: string | RGB; } |
Custom theme for the top navigation |
height |
number |
Not intended for long term use |
id |
string |
The id attribute of the slot |
skipLinkLabel |
string |
The label for this slot's skip link |
xcss |
false | (XCSSValue<"backgroundColor", DesignTokenStyles, ""> & {} & XCSSPseudo<"backgroundColor", never, never, DesignTokenStyles> & XCSSMediaQuery<...> & { ...; } & { ...; }) |
Bounded style overrides |
사용 지침
- 전역 탐색과 액션을 제공하기 위해
Root컴포넌트 안에서TopNav를 렌더링해요.