diff --git a/packages/react/src/TreeView/TreeView.examples.stories.tsx b/packages/react/src/TreeView/TreeView.examples.stories.tsx new file mode 100644 index 00000000000..56d5130c1ed --- /dev/null +++ b/packages/react/src/TreeView/TreeView.examples.stories.tsx @@ -0,0 +1,72 @@ +import {GrabberIcon} from '@primer/octicons-react' +import type {Meta, Story} from '@storybook/react' +import React from 'react' +import Box from '../Box' +import {TreeView} from './TreeView' + +const meta: Meta = { + title: 'Components/TreeView/Examples', + component: TreeView, + decorators: [ + Story => { + return ( + // Prevent TreeView from expanding to the full width of the screen + + + + ) + }, + ], +} + +export const DraggableListItem: Story = () => { + return ( + + + Item 1 + + Item 2 + + sub task 1 + sub task 2 + + + Item 3 + + + ) +} + +const ControlledDraggableItem: React.FC<{id: string; children: React.ReactNode}> = ({id, children}) => { + const [expanded, setExpanded] = React.useState(false) + + return ( + <> + + { + setExpanded(false) + // other drag logic to follow + }} + /> + {children} + + + ) +} + +export default meta diff --git a/packages/react/src/TreeView/TreeView.features.stories.tsx b/packages/react/src/TreeView/TreeView.features.stories.tsx index 12a97917e90..a1e9e4a5f37 100644 --- a/packages/react/src/TreeView/TreeView.features.stories.tsx +++ b/packages/react/src/TreeView/TreeView.features.stories.tsx @@ -993,10 +993,6 @@ export const WithoutIndentation: Story = () => ( ) export const LeadingAction: Story = () => { - // todo: implement fold on click - // todo: implement hide until hovered - // todo: check if draggy boi should be aria-hidden - return ( diff --git a/packages/react/src/TreeView/TreeView.tsx b/packages/react/src/TreeView/TreeView.tsx index 6ec9316453d..b6e15f6c885 100644 --- a/packages/react/src/TreeView/TreeView.tsx +++ b/packages/react/src/TreeView/TreeView.tsx @@ -211,7 +211,7 @@ const UlBox = styled.ul` .PRIVATE_TreeView-item-leading-action { display: flex; color: ${get('colors.fg.muted')}; - grid-area: 'leadingAction'; + grid-area: leadingAction; } .PRIVATE_TreeView-item-level-line { @@ -851,7 +851,11 @@ TrailingVisual.displayName = 'TreeView.TrailingVisual' // TreeView.LeadingAction const LeadingAction: React.FC = props => { - return + return ( +
+ +
+ ) } LeadingAction.displayName = 'TreeView.LeadingAction'