-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Updated new tab ui with search and load more
- Loading branch information
1 parent
e58b10d
commit 6ddf1c8
Showing
16 changed files
with
211 additions
and
107 deletions.
There are no files selected for viewing
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
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
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
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
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
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
17 changes: 17 additions & 0 deletions
17
app/client/src/pages/Editor/IDE/EditorPane/components/EmptySearchResult.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,17 @@ | ||
import React from "react"; | ||
import { Text } from "design-system"; | ||
import { EDITOR_PANE_TEXTS, createMessage } from "@appsmith/constants/messages"; | ||
|
||
const EmptySearchResult = ({ type }: { type: string }) => { | ||
return ( | ||
<Text | ||
className="font-normal text-center" | ||
color="var(--ads-v2-color-fg-muted)" | ||
kind="body-s" | ||
> | ||
{createMessage(EDITOR_PANE_TEXTS.empty_search_result, type)} | ||
</Text> | ||
); | ||
}; | ||
|
||
export { EmptySearchResult }; |
76 changes: 76 additions & 0 deletions
76
app/client/src/pages/Editor/IDE/EditorPane/components/Group.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,76 @@ | ||
import React, { useState } from "react"; | ||
import type { GroupedListProps } from "./types"; | ||
import { DEFAULT_GROUP_LIST_SIZE } from "./constants"; | ||
import { Flex, List, Text } from "design-system"; | ||
import styled from "styled-components"; | ||
|
||
interface GroupProps { | ||
group: GroupedListProps; | ||
} | ||
|
||
const StyledList = styled(List)` | ||
padding: 0; | ||
gap: 0; | ||
& .ds-load-more .ads-v2-listitem__title { | ||
--color: var(--ads-v2-color-fg-subtle); | ||
} | ||
& .ads-v2-listitem__wrapper .ads-v2-listitem__idesc { | ||
opacity: 0; | ||
} | ||
& .ads-v2-listitem__wrapper:hover .ads-v2-listitem__idesc { | ||
opacity: 1; | ||
} | ||
`; | ||
|
||
const Group: React.FC<GroupProps> = ({ group }) => { | ||
const [visibleItems, setVisibleItems] = useState<number>( | ||
DEFAULT_GROUP_LIST_SIZE, | ||
); | ||
const { className, groupTitle } = group; | ||
const items = group.items.slice(0, visibleItems); | ||
const hasMoreItems = group.items.length > visibleItems; | ||
|
||
const handleLoadMore = () => { | ||
setVisibleItems(group.items.length); | ||
}; | ||
|
||
if (hasMoreItems) { | ||
items.push({ | ||
title: "Load more...", | ||
description: "", | ||
descriptionType: "inline", | ||
onClick: handleLoadMore, | ||
className: "ds-load-more", | ||
}); | ||
} | ||
|
||
// TODO: try to avoid this | ||
if (hasMoreItems && groupTitle === "Datasources") { | ||
items.push(group.items[group.items.length - 1]); | ||
} | ||
|
||
return ( | ||
<Flex | ||
borderBottom="1px solid var(--ads-v2-color-border-muted)" | ||
className="groups-list-group" | ||
flexDirection="column" | ||
key={groupTitle} | ||
pb="spaces-3" | ||
> | ||
{groupTitle ? ( | ||
<Text | ||
className="pr-[var(--ads-v2-spaces-3)] py-[var(--ads-v2-spaces-1)]" | ||
color="var(--ads-v2-color-fg-muted)" | ||
kind="body-s" | ||
> | ||
{groupTitle} | ||
</Text> | ||
) : null} | ||
<StyledList className={className} items={items} /> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export { Group }; |
Oops, something went wrong.