-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: extract segment header into ads #38679
Draft
alex-golovanov
wants to merge
1
commit into
release
Choose a base branch
from
feat/37688-explorer-section-header
base: release
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+114
−0
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
.../design-system/ads/src/Templates/EntityExplorer/SegmentHeader/SegmentHeader.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Canvas, Meta } from "@storybook/blocks"; | ||
|
||
import * as Stories from "./SegmentHeader.stories"; | ||
|
||
<Meta of={Stories} /> | ||
|
||
# Segment Header | ||
|
||
This component is designed as a companion to the `EntityExplorer` component. | ||
It's primary use is to display the tabs that are used to navigate between different actions of the entity explorer. | ||
This is particularly useful when IDE is in split screen mode and entity explorer is in a collapsed state. | ||
|
||
## Anatomy | ||
|
||
It's a flex container that accepts an arbitrary number of children. | ||
|
||
### Default implementation | ||
|
||
<Canvas of={Stories.Basic} /> |
70 changes: 70 additions & 0 deletions
70
...es/design-system/ads/src/Templates/EntityExplorer/SegmentHeader/SegmentHeader.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import React from "react"; | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { ToggleButton } from "../../../ToggleButton"; | ||
import { ScrollArea } from "../../../ScrollArea"; | ||
import { Tab, Tabs, TabsList } from "../../../Tab"; | ||
import { Button } from "../../../Button"; | ||
|
||
import { SegmentHeader } from "."; | ||
|
||
const SCROLL_AREA_OPTIONS = { | ||
overflow: { | ||
x: "scroll", | ||
y: "hidden", | ||
}, | ||
} as const; | ||
|
||
const meta: Meta<typeof SegmentHeader> = { | ||
title: "ADS/Templates/Entity Explorer/Segment Header", | ||
component: SegmentHeader, | ||
}; | ||
|
||
export default meta; | ||
|
||
interface Args { | ||
width: number; | ||
} | ||
|
||
const Template = ({ width }: Args) => { | ||
// TODO: replace SegmentHeader children with proper components when ready | ||
return ( | ||
<div style={{ width }}> | ||
<SegmentHeader> | ||
<ToggleButton icon="hamburger" size="md" /> | ||
<ScrollArea | ||
data-testid="t--editor-tabs" | ||
options={SCROLL_AREA_OPTIONS} | ||
size="sm" | ||
style={{ height: 32, top: 0.5 }} | ||
> | ||
<Tabs defaultValue="tab1"> | ||
<TabsList> | ||
<Tab notificationCount={3} value="tab1"> | ||
Account | ||
</Tab> | ||
<Tab notificationCount={15} value="tab2"> | ||
Password | ||
</Tab> | ||
<Tab value="tab3">Account</Tab> | ||
<Tab value="tab4">Test</Tab> | ||
<Tab value="tab5">General</Tab> | ||
</TabsList> | ||
</Tabs> | ||
</ScrollArea> | ||
<Button | ||
isIconButton | ||
kind="tertiary" | ||
startIcon="maximize-v3" | ||
style={{ marginLeft: "auto", minWidth: 24 }} | ||
/> | ||
</SegmentHeader> | ||
</div> | ||
); | ||
}; | ||
|
||
export const Basic = Template.bind({}) as StoryObj; | ||
|
||
Basic.args = { | ||
width: 500, | ||
}; |
14 changes: 14 additions & 0 deletions
14
...ages/design-system/ads/src/Templates/EntityExplorer/SegmentHeader/SegmentHeader.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import styled from "styled-components"; | ||
|
||
export const Root = styled.div` | ||
display: flex; | ||
align-items: center; | ||
border-bottom: 1px solid var(--ads-v2-color-border-muted); | ||
background-color: var(--ads-v2-color-bg); | ||
gap: var(--ads-v2-spaces-2); | ||
max-height: 32px; | ||
min-height: 32px; | ||
padding: 0 var(--ads-v2-spaces-2); | ||
width: 100%; | ||
overflow: hidden; | ||
`; |
10 changes: 10 additions & 0 deletions
10
...t/packages/design-system/ads/src/Templates/EntityExplorer/SegmentHeader/SegmentHeader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from "react"; | ||
|
||
import * as Styled from "./SegmentHeader.styles"; | ||
|
||
interface SegmentHeaderProps { | ||
children: React.ReactNode; | ||
} | ||
export function SegmentHeader({ children }: SegmentHeaderProps) { | ||
return <Styled.Root>{children}</Styled.Root>; | ||
} | ||
alex-golovanov marked this conversation as resolved.
Show resolved
Hide resolved
|
1 change: 1 addition & 0 deletions
1
app/client/packages/design-system/ads/src/Templates/EntityExplorer/SegmentHeader/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { SegmentHeader } from "./SegmentHeader"; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we not do it in the below format?
CC: @hetunandu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Short answer - no.
Long answer is - it's too limiting and super inconvenient to work with, at the same time this approach does not offer any protection against passing literally anything in those props. Additionally we cannot have tabs wrapped up in this particular component as it is in ADS and tabs will be wrapped up in all kinds of business logic.
@ankitakinger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per our discussion, this will need a bit more thought, moving it to a draft state for now.