Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.Container {
max-width: 400px;
}

/* stylelint-disable selector-class-pattern */
.DraggableContainer .treeview-item .treeview-leading-action {
visibility: hidden;
}

.DraggableContainer .treeview-item:hover .treeview-leading-action,
.DraggableContainer .treeview-item:focus .treeview-leading-action {
visibility: visible;
}
/* stylelint-enable selector-class-pattern */
20 changes: 5 additions & 15 deletions packages/react/src/TreeView/TreeView.examples.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {GrabberIcon} from '@primer/octicons-react'
import type {Meta, StoryFn} from '@storybook/react-vite'
import React from 'react'
import Box from '../Box'
import {TreeView} from './TreeView'
import {IconButton} from '../Button'
import classes from './TreeView.examples.stories.module.css'

const meta: Meta = {
title: 'Components/TreeView/Examples',
Expand All @@ -12,27 +12,17 @@ const meta: Meta = {
Story => {
return (
// Prevent TreeView from expanding to the full width of the screen
<Box sx={{maxWidth: 400}}>
<div className={classes.Container}>
<Story />
</Box>
</div>
)
},
],
}

export const DraggableListItem: StoryFn = () => {
return (
<Box
sx={{
// using Box for css, this could be in a css file as well
'.treeview-item': {
'.treeview-leading-action': {visibility: 'hidden'},
'&:hover, &:focus': {
'.treeview-leading-action': {visibility: 'visible'},
},
},
}}
>
<div className={classes.DraggableContainer}>
<TreeView aria-label="Issues">
<ControlledDraggableItem id="item-1">Item 1</ControlledDraggableItem>
<ControlledDraggableItem id="item-2">
Expand All @@ -44,7 +34,7 @@ export const DraggableListItem: StoryFn = () => {
</ControlledDraggableItem>
<ControlledDraggableItem id="item-3">Item 3</ControlledDraggableItem>
</TreeView>
</Box>
</div>
)
}

Expand Down