1- import React , { FC , useContext , useCallback } from 'react'
2- import { capitalize } from 'lodash'
1+ import React , { FC , useCallback , useContext } from 'react'
32import {
3+ PinnedItem ,
44 PinnedItemsContext ,
55 PinnedItemTypes ,
6- PinnedItem ,
76} from 'src/shared/contexts/pinneditems'
8-
9- import { Context } from 'src/clockface'
10- import { ComponentColor , IconFont , Panel } from '@influxdata/clockface'
7+ import {
8+ ButtonShape ,
9+ ComponentColor ,
10+ ComponentSize ,
11+ ConfirmationButton ,
12+ FlexBox ,
13+ Heading ,
14+ HeadingElement ,
15+ IconFont ,
16+ Panel ,
17+ ResourceCard ,
18+ Typeface ,
19+ } from '@influxdata/clockface'
1120
1221import './PinnedItems.scss'
1322
14- import { ResourceCard } from '@influxdata/clockface'
15-
1623import { useHistory } from 'react-router-dom'
1724import { CLOUD } from 'src/shared/constants'
1825import { isFlagEnabled } from 'src/shared/utils/featureFlag'
@@ -53,12 +60,16 @@ const PinnedItems: FC = () => {
5360 await deletePinnedItemsHelper ( itemId )
5461 }
5562 const EmptyState = ( ) => (
56- < h3 data-testid = "pinneditems--emptystate" >
63+ < Heading element = { HeadingElement . H5 } testID = "pinneditems--emptystate" >
5764 Pin a task, dashboard, or notebook here
58- </ h3 >
65+ </ Heading >
5966 )
67+
68+ const mainPanelStyle = { margin : '4px 0px' }
69+ const resourceCardStyle = { marginTop : '0px' }
70+
6071 return CLOUD && isFlagEnabled ( 'pinnedItems' ) ? (
61- < Panel style = { { margin : '4px 0px' } } >
72+ < Panel style = { mainPanelStyle } >
6273 < Panel . Header >
6374 < h2 className = "pinned-items--header" > Pinned Items</ h2 >
6475 </ Panel . Header >
@@ -73,33 +84,35 @@ const PinnedItems: FC = () => {
7384 testID = "pinneditems--card"
7485 className = "pinned-items--card"
7586 contextMenu = {
76- < Context >
77- < Context . Menu
87+ < FlexBox margin = { ComponentSize . ExtraSmall } >
88+ < ConfirmationButton
89+ color = { ComponentColor . Colorless }
7890 icon = { IconFont . Trash_New }
79- color = { ComponentColor . Danger }
91+ shape = { ButtonShape . Square }
92+ size = { ComponentSize . ExtraSmall }
93+ confirmationLabel = "Unpin this item?"
94+ onConfirm = { ( ) => handleDeletePinnedItem ( item . id ) }
95+ confirmationButtonText = "Yes"
8096 testID = "pinneditems-delete--menu"
81- >
82- < Context . Item
83- label = "Unpin"
84- action = { ( ) => handleDeletePinnedItem ( item . id ) }
85- testID = "pinneditems-delete--confirm"
86- />
87- </ Context . Menu >
88- </ Context >
97+ />
98+ </ FlexBox >
8999 }
100+ style = { resourceCardStyle }
90101 >
91- < ResourceCard . Name
92- testID = "pinneditems--type"
93- name = { capitalize ( item . type ) }
94- />
102+ < ResourceCard . Meta >
103+ < Heading
104+ type = { Typeface . IBMPlexMono }
105+ element = { HeadingElement . H5 }
106+ testID = "pinneditems--type"
107+ >
108+ { item . type . toUpperCase ( ) }
109+ </ Heading >
110+ </ ResourceCard . Meta >
95111 < ResourceCard . Name
96112 name = { item . metadata . name ?? '' }
97113 onClick = { ( ) => followMetadataToRoute ( item ) }
98114 testID = "pinneditems--link"
99115 />
100- < ResourceCard . Description
101- description = { item . metadata . description ?? '' }
102- />
103116 </ ResourceCard >
104117 ) )
105118 ) : (
0 commit comments