Skip to content

Commit 4a26e28

Browse files
feat: pinned items UI revamp (#3216)
1 parent 0c9d265 commit 4a26e28

File tree

3 files changed

+47
-34
lines changed

3 files changed

+47
-34
lines changed

cypress/e2e/cloud/pinned.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ describe('Pinned Items', () => {
101101
.first()
102102
.trigger('mouseover')
103103
.within(() => {
104-
cy.getByTestID('pinneditems-delete--menu').click()
105-
cy.getByTestID('pinneditems-delete--confirm').click()
104+
cy.getByTestID('pinneditems-delete--menu--button').click()
106105
})
106+
cy.getByTestID('pinneditems-delete--menu--confirm-button').click()
107107
cy.getByTestID('pinneditems--emptystate').should(
108108
'contain.text',
109109
'Pin a task, dashboard, or notebook here'
@@ -267,7 +267,7 @@ from(bucket: "${name}"{rightarrow}
267267
cy.visit('/')
268268
cy.getByTestID('tree-nav')
269269
cy.getByTestID('pinneditems--container').within(() => {
270-
cy.getByTestID('pinneditems--type').should('contain.text', 'Notebook')
270+
cy.getByTestID('pinneditems--type').should('contain.text', 'NOTEBOOK')
271271
})
272272
})
273273

src/me/components/PinnedItems.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@import '@influxdata/clockface/dist/variables.scss';
2-
$dashboard-grid-gap: $cf-space-3xs;
2+
$dashboard-grid-gap: $cf-space-2xs;
33

44
.pinned-items--header {
55
font-weight: 400;
@@ -20,7 +20,7 @@ $dashboard-grid-gap: $cf-space-3xs;
2020
}
2121

2222
.pinned-items--card {
23-
background: rgb(49, 49, 61);
23+
background: $cf-grey-25;
2424
}
2525

2626
@media screen and (max-width: $cf-grid--breakpoint-md) {

src/me/components/PinnedItems.tsx

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1-
import React, {FC, useContext, useCallback} from 'react'
2-
import {capitalize} from 'lodash'
1+
import React, {FC, useCallback, useContext} from 'react'
32
import {
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

1221
import './PinnedItems.scss'
1322

14-
import {ResourceCard} from '@influxdata/clockface'
15-
1623
import {useHistory} from 'react-router-dom'
1724
import {CLOUD} from 'src/shared/constants'
1825
import {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

Comments
 (0)