-
Notifications
You must be signed in to change notification settings - Fork 4.6k
chore: Move IDE header to ADS/Templates #37764
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4fa2aca
chore: Transfer IDE components
hetunandu 8940eca
ADS changes
hetunandu 7df7ad0
folder changes
hetunandu 8d78cf8
remove old files
hetunandu 4077591
Create story
hetunandu 6556665
Merge branch 'release' into chore/ide-components
hetunandu 45c851e
fix tests
hetunandu 2ec019b
revert yarn.lock changes
hetunandu f6b0c26
rename folder in ADS to Templates
hetunandu 60cc915
the case of the missing children
hetunandu 54b3d3e
fix export path in ads
hetunandu cf265ba
Merge branch 'release' into chore/ide-components
hetunandu 04b09c8
Merge branch 'release' into chore/ide-components
hetunandu f66c3d9
address Review comments
hetunandu e7e38bb
allow for single child
hetunandu e28c56e
fix scrolling
hetunandu 2e97ea1
fix: Remove test because it does not run on EE
hetunandu dfcf5d6
Merge branch 'release' into chore/ide-components
hetunandu 84d897a
Merge branch 'release' into chore/ide-components
hetunandu 873e6c8
update styles
hetunandu 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
38 changes: 38 additions & 0 deletions
38
app/client/packages/design-system/ads/src/Templates/EntityExplorer/ListWithHeader.tsx
This file contains hidden or 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,38 @@ | ||
| import React from "react"; | ||
| import { ListHeaderContainer } from "./styles"; | ||
| import { Text } from "../../Text"; | ||
| import { Flex } from "../../Flex"; | ||
|
|
||
| interface Props { | ||
| headerText: string; | ||
| headerControls?: React.ReactNode; | ||
| maxHeight?: string; | ||
| headerClassName?: string; | ||
| children: React.ReactNode | React.ReactNode[]; | ||
| } | ||
|
|
||
| export const ListWithHeader = (props: Props) => { | ||
| return ( | ||
| <Flex | ||
| flexDirection="column" | ||
| justifyContent="center" | ||
| maxHeight={props.maxHeight} | ||
| overflow="hidden" | ||
| > | ||
| <ListHeaderContainer className={props.headerClassName}> | ||
| <Text kind="heading-xs">{props.headerText}</Text> | ||
| {props.headerControls} | ||
| </ListHeaderContainer> | ||
| <Flex | ||
| alignItems="center" | ||
| flex="1" | ||
| flexDirection="column" | ||
| overflow="auto" | ||
| px="spaces-2" | ||
| width="100%" | ||
| > | ||
| {props.children} | ||
| </Flex> | ||
| </Flex> | ||
| ); | ||
| }; | ||
|
hetunandu marked this conversation as resolved.
|
||
2 changes: 2 additions & 0 deletions
2
app/client/packages/design-system/ads/src/Templates/EntityExplorer/index.ts
This file contains hidden or 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,2 @@ | ||
| export { ListItemContainer, ListHeaderContainer } from "./styles"; | ||
| export { ListWithHeader } from "./ListWithHeader"; |
23 changes: 23 additions & 0 deletions
23
app/client/packages/design-system/ads/src/Templates/EntityExplorer/styles.ts
This file contains hidden or 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,23 @@ | ||
| import styled from "styled-components"; | ||
|
|
||
| export const ListItemContainer = styled.div` | ||
| width: 100%; | ||
|
|
||
| & .t--entity-item { | ||
| grid-template-columns: 0 auto 1fr auto auto auto auto auto; | ||
| height: 32px; | ||
| } | ||
| `; | ||
|
|
||
| export const ListHeaderContainer = styled.div` | ||
| padding: var(--ads-v2-spaces-3); | ||
| padding-right: var(--ads-v2-spaces-2); | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| height: 40px; | ||
|
|
||
| span { | ||
| line-height: 20px; | ||
| } | ||
| `; |
20 changes: 20 additions & 0 deletions
20
...ackages/design-system/ads/src/Templates/IDEHeader/HeaderSwitcher/HeaderSwitcher.styles.ts
This file contains hidden or 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,20 @@ | ||
| import styled from "styled-components"; | ||
| import { PopoverContent } from "../../../Popover"; | ||
|
|
||
| export const SwitchTrigger = styled.div<{ active: boolean }>` | ||
| display: flex; | ||
| border-radius: var(--ads-v2-border-radius); | ||
| background-color: ${(props) => | ||
| props.active ? `var(--ads-v2-color-bg-subtle)` : "unset"}; | ||
| cursor: pointer; | ||
| padding: var(--ads-v2-spaces-2); | ||
|
|
||
| :hover { | ||
| background-color: var(--ads-v2-color-bg-subtle); | ||
| } | ||
| `; | ||
|
|
||
| export const ContentContainer = styled(PopoverContent)` | ||
| padding: 0; | ||
| padding-bottom: 0.25em; | ||
| `; |
88 changes: 88 additions & 0 deletions
88
...t/packages/design-system/ads/src/Templates/IDEHeader/HeaderSwitcher/IDEHeaderSwitcher.tsx
This file contains hidden or 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,88 @@ | ||
| import React, { type ForwardedRef, useCallback } from "react"; | ||
| import { Flex } from "../../../Flex"; | ||
| import { Icon } from "../../../Icon"; | ||
| import { Popover, PopoverTrigger } from "../../../Popover"; | ||
| import { Text } from "../../../Text"; | ||
| import * as Styled from "./HeaderSwitcher.styles"; | ||
|
|
||
| interface Props { | ||
| prefix: string; | ||
| title?: string; | ||
| titleTestId: string; | ||
| active: boolean; | ||
| setActive: (active: boolean) => void; | ||
| onClick?: React.MouseEventHandler<HTMLDivElement>; | ||
| className?: string; | ||
| children: React.ReactNode; | ||
| } | ||
|
|
||
| export const IDEHeaderSwitcher = React.forwardRef( | ||
| (props: Props, ref: ForwardedRef<HTMLDivElement>) => { | ||
| const { | ||
| active, | ||
| children, | ||
| className, | ||
| onClick, | ||
| prefix, | ||
| setActive, | ||
| title, | ||
| titleTestId, | ||
| ...rest | ||
| } = props; | ||
|
|
||
| const separator = title ? " /" : ""; | ||
|
|
||
| const closeSwitcher = useCallback(() => { | ||
| return setActive(false); | ||
| }, [setActive]); | ||
|
|
||
| return ( | ||
| <Popover onOpenChange={setActive} open={active}> | ||
| <PopoverTrigger> | ||
| <Styled.SwitchTrigger | ||
| active={active} | ||
| className={`flex align-center items-center justify-center ${className}`} | ||
| data-testid={titleTestId} | ||
| onClick={onClick} | ||
| ref={ref} | ||
| {...rest} | ||
| > | ||
| <Text | ||
| color="var(--ads-v2-colors-content-label-inactive-fg)" | ||
| kind="body-m" | ||
| > | ||
| {prefix + separator} | ||
| </Text> | ||
| <Flex | ||
| alignItems="center" | ||
| className={titleTestId} | ||
| data-active={active} | ||
| gap="spaces-1" | ||
| height="100%" | ||
| justifyContent="center" | ||
| paddingLeft="spaces-2" | ||
| > | ||
| <Text isBold kind="body-m"> | ||
| {title} | ||
| </Text> | ||
| <Icon | ||
| color={ | ||
| title | ||
| ? undefined | ||
| : "var(--ads-v2-colors-content-label-inactive-fg)" | ||
| } | ||
| name={active ? "arrow-up-s-line" : "arrow-down-s-line"} | ||
| size="md" | ||
| /> | ||
| </Flex> | ||
| </Styled.SwitchTrigger> | ||
| </PopoverTrigger> | ||
| <Styled.ContentContainer align="start" onEscapeKeyDown={closeSwitcher}> | ||
| {children} | ||
| </Styled.ContentContainer> | ||
| </Popover> | ||
| ); | ||
| }, | ||
| ); | ||
|
|
||
| IDEHeaderSwitcher.displayName = "IDEHeaderSwitcher"; |
1 change: 1 addition & 0 deletions
1
app/client/packages/design-system/ads/src/Templates/IDEHeader/HeaderSwitcher/index.ts
This file contains hidden or 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 { IDEHeaderSwitcher } from "./IDEHeaderSwitcher"; |
2 changes: 2 additions & 0 deletions
2
app/client/packages/design-system/ads/src/Templates/IDEHeader/IDEHeader.constants.ts
This file contains hidden or 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,2 @@ | ||
| export const IDE_HEADER_HEIGHT = 40; | ||
| export const LOGO_WIDTH = 50; |
28 changes: 28 additions & 0 deletions
28
app/client/packages/design-system/ads/src/Templates/IDEHeader/IDEHeader.mdx
This file contains hidden or 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,28 @@ | ||
| import { Canvas, Meta } from "@storybook/blocks"; | ||
| import * as IDEHeaderStories from "./IDEHeader.stories"; | ||
|
|
||
| <Meta of={IDEHeaderStories} /> | ||
|
|
||
| # IDEHeader | ||
|
|
||
| IDEHeader sets the stage for the IDE experience. It is the topmost section of the IDE that contains the Appsmith logo, the app name, and the user profile. | ||
|
|
||
| <Canvas of={IDEHeaderStories.Default} /> | ||
|
|
||
| ## Anatomy | ||
|
|
||
| ### Left Section options | ||
|
|
||
| The local title | ||
|
|
||
| #### Header Title | ||
|
|
||
| A title that is specific to the app state. It is displayed on the left side of the header. | ||
|
|
||
| <Canvas of={IDEHeaderStories.WithHeaderTitle} /> | ||
|
|
||
| #### Header Dropdown | ||
|
|
||
| A dropdown that allows the user to switch between different pages. | ||
|
|
||
| <Canvas of={IDEHeaderStories.WithHeaderDropdown} /> |
109 changes: 109 additions & 0 deletions
109
app/client/packages/design-system/ads/src/Templates/IDEHeader/IDEHeader.stories.tsx
This file contains hidden or 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,109 @@ | ||
| import React from "react"; | ||
| import type { Meta } from "@storybook/react"; | ||
| import { IDEHeader } from "./IDEHeader"; | ||
| import { IDEHeaderTitle } from "./IDEHeaderTitle"; | ||
| import { IDEHeaderSwitcher } from "./HeaderSwitcher"; | ||
| import { noop } from "lodash"; | ||
| import { Icon } from "../../Icon"; | ||
| import { Button } from "../../Button"; | ||
| import { List } from "../../List"; | ||
| import { Flex } from "../../Flex"; | ||
| import { Text } from "../../Text"; | ||
| import { ListHeaderContainer } from "../EntityExplorer/styles"; | ||
|
|
||
| const meta: Meta = { | ||
| title: "ADS/Templates/IDEHeader", | ||
| component: IDEHeader, | ||
| parameters: { | ||
| layout: "fullscreen", | ||
| }, | ||
| decorators: [ | ||
| (Story: () => React.ReactNode) => ( | ||
| <div style={{ width: "100%" }}>{Story()}</div> | ||
| ), | ||
| ], | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| export const Default = () => ( | ||
| <IDEHeader> | ||
| <IDEHeader.Left logo={<Icon name="upload-cloud" size="md" />}> | ||
| <span>Left Content</span> | ||
| </IDEHeader.Left> | ||
| <IDEHeader.Center> | ||
| <span>Center Content</span> | ||
| </IDEHeader.Center> | ||
| <IDEHeader.Right> | ||
| <span>Right Content</span> | ||
| </IDEHeader.Right> | ||
| </IDEHeader> | ||
| ); | ||
|
|
||
| export const WithHeaderTitle = () => { | ||
| return ( | ||
| <IDEHeader> | ||
| <IDEHeader.Left logo={<Icon name="upload-cloud" size="md" />}> | ||
| <IDEHeaderTitle title="Settings" /> | ||
| </IDEHeader.Left> | ||
| <IDEHeader.Center> | ||
| <div /> | ||
| </IDEHeader.Center> | ||
| <IDEHeader.Right> | ||
| <div /> | ||
| </IDEHeader.Right> | ||
| </IDEHeader> | ||
| ); | ||
| }; | ||
|
|
||
| export const WithHeaderDropdown = () => { | ||
| const [open, setOpen] = React.useState(false); | ||
|
|
||
| return ( | ||
| <IDEHeader> | ||
| <IDEHeader.Left logo={<Icon name="upload-cloud" size="md" />}> | ||
| <IDEHeaderSwitcher | ||
| active={open} | ||
| prefix={"Pages"} | ||
| setActive={setOpen} | ||
| title="Page1" | ||
| titleTestId={"testId"} | ||
| > | ||
| <Flex | ||
| flexDirection="column" | ||
| justifyContent="center" | ||
| maxHeight={"300px"} | ||
| overflow="hidden" | ||
| > | ||
| <ListHeaderContainer> | ||
| <Text kind="heading-xs">Pages</Text> | ||
| <Button isIconButton kind="tertiary" startIcon="plus" /> | ||
|
hetunandu marked this conversation as resolved.
|
||
| </ListHeaderContainer> | ||
| <List | ||
| items={[ | ||
| { | ||
| title: "Page1", | ||
| onClick: noop, | ||
| description: "", | ||
| descriptionType: "inline", | ||
| }, | ||
| { | ||
| title: "Page2", | ||
| onClick: noop, | ||
| description: "", | ||
| descriptionType: "inline", | ||
| }, | ||
| ]} | ||
| /> | ||
| </Flex> | ||
| </IDEHeaderSwitcher> | ||
| </IDEHeader.Left> | ||
| <IDEHeader.Center> | ||
| <div /> | ||
| </IDEHeader.Center> | ||
| <IDEHeader.Right> | ||
| <div /> | ||
| </IDEHeader.Right> | ||
| </IDEHeader> | ||
| ); | ||
| }; | ||
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.
Uh oh!
There was an error while loading. Please reload this page.