File tree Expand file tree Collapse file tree 3 files changed +95
-0
lines changed
src/content/components/uikit Expand file tree Collapse file tree 3 files changed +95
-0
lines changed Original file line number Diff line number Diff line change 1+ import { ActionTooltip , Button } from '@gravity-ui/uikit' ;
2+ import type { ActionTooltipProps } from '@gravity-ui/uikit' ;
3+ import React from 'react' ;
4+
5+ type ActionTooltipComponentProps = Pick <
6+ ActionTooltipProps ,
7+ 'title' | 'description' | 'hotkey' | 'disabled' | 'placement'
8+ > & {
9+ trigger : ActionTooltipProps [ 'trigger' ] | 'hover' ;
10+ } ;
11+
12+ export const ActionTooltipComponent = ( {
13+ title,
14+ description,
15+ hotkey,
16+ disabled,
17+ trigger,
18+ placement,
19+ } : ActionTooltipComponentProps ) => {
20+ return (
21+ < ActionTooltip
22+ title = { title }
23+ description = { description }
24+ hotkey = { hotkey }
25+ trigger = { trigger === 'hover' ? undefined : trigger }
26+ placement = { placement }
27+ disabled = { disabled }
28+ >
29+ < Button > { trigger ?? 'hover' } me</ Button >
30+ </ ActionTooltip >
31+ ) ;
32+ } ;
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 , mappingOptions } from '../../utils' ;
5+
6+ const getterOptions = { repoName : Repos . Uikit , componentName : 'ActionTooltip' } ;
7+
8+ export const actionTooltipConfig = {
9+ id : 'action-tooltip' ,
10+ title : 'ActionTooltip' ,
11+ githubUrl : getGithubUrl ( getterOptions ) ,
12+ content : {
13+ readmeUrl : getReadmeUrl ( getterOptions ) ,
14+ } ,
15+ sandbox : {
16+ component : dynamic ( ( ) =>
17+ import ( './ActionTooltipComponent' ) . then ( ( mod ) => mod . ActionTooltipComponent ) ,
18+ ) ,
19+ props : {
20+ title : {
21+ type : 'input' ,
22+ defaultValue : 'Title' ,
23+ } ,
24+ description : {
25+ type : 'input' ,
26+ defaultValue : 'Description' ,
27+ } ,
28+ hotkey : {
29+ type : 'input' ,
30+ defaultValue : 'shift+t' ,
31+ } ,
32+ disabled : {
33+ type : 'switch' ,
34+ defaultValue : false ,
35+ } ,
36+ trigger : {
37+ type : 'select' ,
38+ values : mappingOptions ( [ 'focus' , 'hover' ] ) ,
39+ defaultValue : 'hover' ,
40+ } ,
41+ placement : {
42+ type : 'select' ,
43+ values : mappingOptions ( [
44+ 'bottom-start' ,
45+ 'bottom' ,
46+ 'bottom-end' ,
47+ 'top-start' ,
48+ 'top' ,
49+ 'top-end' ,
50+ 'right-start' ,
51+ 'right' ,
52+ 'right-end' ,
53+ 'left-start' ,
54+ 'left' ,
55+ 'left-end' ,
56+ ] ) ,
57+ defaultValue : 'bottom' ,
58+ } ,
59+ } ,
60+ } ,
61+ } ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import {getLibConfigById} from '../../../libs/config';
44import { Component , Lib } from '../types' ;
55
66import { accordionConfig } from './Accordion' ;
7+ import { actionTooltipConfig } from './ActionTooltip' ;
78import { alertConfig } from './Alert' ;
89import { arrowToggleConfig } from './ArrowToggle' ;
910import { avatarConfig } from './Avatar' ;
@@ -54,6 +55,7 @@ const uikitComponents: Component[] = [
5455 alertConfig ,
5556 arrowToggleConfig ,
5657 avatarConfig ,
58+ actionTooltipConfig ,
5759 breadcrumbsConfig ,
5860 buttonConfig ,
5961 cardConfig ,
You can’t perform that action at this time.
0 commit comments