File tree Expand file tree Collapse file tree 3 files changed +75
-0
lines changed
src/content/components/uikit Expand file tree Collapse file tree 3 files changed +75
-0
lines changed Original file line number Diff line number Diff line change 1+ import { Toc } from '@gravity-ui/uikit' ;
2+ import React from 'react' ;
3+
4+ const items = [
5+ {
6+ value : 'vm' ,
7+ content : 'Virtual machine creation' ,
8+ } ,
9+ {
10+ value : 'info' ,
11+ content : 'Getting information about a group of virtual machines' ,
12+ } ,
13+ {
14+ value : 'disk' ,
15+ content : 'Disk' ,
16+ items : [
17+ {
18+ value : 'control' ,
19+ content : 'Disk controls' ,
20+ items : [
21+ {
22+ value : 'floppy' ,
23+ content : 'Floppy' ,
24+ } ,
25+ {
26+ value : 'hard' ,
27+ content : 'Hard' ,
28+ items : [ ] ,
29+ } ,
30+ ] ,
31+ } ,
32+ {
33+ value : 'snapshots' ,
34+ content : 'Disk snapshots' ,
35+ items : [
36+ {
37+ value : 'standard' ,
38+ content : 'Standard' ,
39+ } ,
40+ ] ,
41+ } ,
42+ ] ,
43+ } ,
44+ {
45+ value : 'images' ,
46+ content : 'Images with preinstalled software' ,
47+ } ,
48+ ] ;
49+
50+ export const TocComponent = ( ) => {
51+ const [ value , setValue ] = React . useState ( 'vm' ) ;
52+
53+ return < Toc items = { items } value = { value } onUpdate = { setValue } /> ;
54+ } ;
Original file line number Diff line number Diff line change 1+ import dynamic from 'next/dynamic' ;
2+
3+ import { Repos } from '../../../../types/common' ;
4+ import { getGithubUrl , getReadmeUrl } from '../../utils' ;
5+
6+ const getterOptions = { repoName : Repos . Uikit , componentName : 'Toc' } ;
7+
8+ export const tocConfig = {
9+ id : 'toc' ,
10+ title : 'Toc' ,
11+ githubUrl : getGithubUrl ( getterOptions ) ,
12+ content : {
13+ readmeUrl : getReadmeUrl ( getterOptions ) ,
14+ } ,
15+ sandbox : {
16+ component : dynamic ( ( ) => import ( './TocComponent' ) . then ( ( mod ) => mod . TocComponent ) ) ,
17+ props : { } ,
18+ } ,
19+ } ;
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ import {textConfig} from './Text';
4848import { textAreaConfig } from './TextArea' ;
4949import { textInputConfig } from './TextInput' ;
5050import { config as toasterConfig } from './Toaster' ;
51+ import { tocConfig } from './Toc' ;
5152import { tooltipConfig } from './Tooltip' ;
5253import { userConfig } from './User' ;
5354import { userLabelConfig } from './UserLabel' ;
@@ -97,6 +98,7 @@ const uikitComponents: Component[] = [
9798 textInputConfig ,
9899 tooltipConfig ,
99100 toasterConfig ,
101+ tocConfig ,
100102 userConfig ,
101103 userLabelConfig ,
102104 sheetConfig ,
You can’t perform that action at this time.
0 commit comments