Skip to content
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

Continuing transition to Tailwind #657

Merged
merged 12 commits into from
Nov 5, 2024
Merged
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
},
"typescript.tsdk": "node_modules/typescript/lib",
"vitest.workspaceConfig": "vitest.workspace.ts",
"editor.quickSuggestions": {
"strings": "on"
},
"tailwindCSS.rootFontSize": 14,
"tailwindCSS.experimental.classRegex": [
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
Expand Down
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- **Improved** UI responsiveness by using map instead of array for large data
sets [#658](https://github.com/aws/graph-explorer/pull/658)
- **Improved** connection selection can now happen on any part of the connection
row [#657](https://github.com/aws/graph-explorer/pull/657)
- **Fixed** scrolling on search result details
[#657](https://github.com/aws/graph-explorer/pull/657)
- **Improved** style for the sidebar buttons
[#651](https://github.com/aws/graph-explorer/pull/651)
- **Fixed** Docker image containing more files than necessary.
Expand Down
1 change: 1 addition & 0 deletions packages/graph-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"@react-stately/searchfield": "^3.5.7",
"@tanstack/react-query": "^5.59.9",
"@tanstack/react-query-devtools": "^5.59.9",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"color": "^4.2.3",
"crypto-js": "^4.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ const listStyles: ThemeStyleFn = ({ theme, isDarkTheme }) => {
.advanced-list-search-wrapper {
display: flex;
align-items: center;
.advanced-list-search-input {
flex: 2;
}

.advanced-list-category-select {
flex: 1;
}

.select {
min-width: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ export type AdvancedListProps<T extends object> = {
category?: string;
onItemClick?: (
event: MouseEvent<HTMLDivElement>,
item: AdvancedListItemType<any>,
item: AdvancedListItemType<T>,
index: number
) => void;
onItemMouseOver?: (
event: MouseEvent<HTMLElement>,
item: AdvancedListItemType<any>,
item: AdvancedListItemType<T>,
index: number
) => void;
onItemMouseOut?: (
event: MouseEvent<HTMLElement>,
item: AdvancedListItemType<any>,
item: AdvancedListItemType<T>,
index: number
) => void;
onItemMouseEnter?: AdvancedListMouseEvent;
Expand All @@ -83,7 +83,7 @@ export type AdvancedListProps<T extends object> = {
hideCount?: boolean;
hideEmptyState?: boolean;
renderPopover?: (
item: AdvancedListItemType<any>,
item: AdvancedListItemType<T>,
itemRef: RefObject<HTMLDivElement>
) => ReactNode;
hidePopover?: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { cn } from "@/utils";
import groupBy from "lodash/groupBy";
import type { DragEvent, MouseEvent, ReactNode, Ref, RefObject } from "react";
import type {
DragEvent,
ForwardedRef,
MouseEvent,
PropsWithChildren,
ReactNode,
Ref,
RefObject,
} from "react";
import { forwardRef, memo, useEffect, useMemo, useState } from "react";
import type { VirtuosoHandle } from "react-virtuoso";
import { GroupedVirtuoso } from "react-virtuoso";
Expand Down Expand Up @@ -305,4 +313,8 @@ const AdvancedListWithGroups = <T extends object>(
);
};

export default memo(forwardRef(AdvancedListWithGroups));
export default memo(forwardRef(AdvancedListWithGroups)) as <T extends object>(
props: PropsWithChildren<ElementsListWithGroupsProps<T>> & {
ref?: ForwardedRef<VirtuosoHandle>;
}
) => ReturnType<typeof AdvancedListWithGroups>;
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const SearchBar = ({
return (
<>
<Input
className={"advanced-list-search-input"}
className="flex-[2]"
value={search}
aria-label="Search available items"
onChange={onSearch}
Expand All @@ -37,7 +37,7 @@ const SearchBar = ({
{!!types.length && onTypeChange && (
<Select
aria-label="select category"
className={"advanced-list-category-select"}
className="flex-1"
options={types}
value={type}
onChange={value => onTypeChange?.(value as string)}
Expand Down
6 changes: 3 additions & 3 deletions packages/graph-explorer/src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface CardProps
onClick?: () => void;
}

export const Card = (
export function Card(
{
id,
className,
Expand All @@ -29,7 +29,7 @@ export const Card = (
...restProps
}: PropsWithChildren<CardProps>,
ref: ForwardedRef<HTMLDivElement>
) => {
) {
const styleWithTheme = useWithTheme();
return (
<div
Expand All @@ -55,6 +55,6 @@ export const Card = (
{children}
</div>
);
};
}

export default forwardRef<HTMLDivElement, PropsWithChildren<CardProps>>(Card);
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import { css } from "@emotion/css";
import { ActiveThemeType, fade, ProcessedTheme } from "@/core";

export const defaultStyles = () => css`
display: flex;
.swiper {
height: 484px;
width: 320px;
}
`;

export const navArrowsStyles = ({
theme,
}: ActiveThemeType<ProcessedTheme>) => css`
Expand Down
18 changes: 6 additions & 12 deletions packages/graph-explorer/src/components/Carousel/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
} from "swiper/types";
import { useWithTheme } from "@/core";
import { ChevronLeftIcon, ChevronRightIcon } from "@/components/icons";
import { defaultStyles, navArrowsStyles } from "./Carousel.styles";
import { navArrowsStyles } from "./Carousel.styles";

export interface CarouselProps {
className?: string;
Expand All @@ -38,7 +38,6 @@ export interface CarouselProps {
prevArrow?: JSX.Element;
slidesToShow?: number;
swipe?: boolean;
variableWidth?: boolean;
}

const PrevArrow = forwardRef<
Expand Down Expand Up @@ -99,7 +98,6 @@ export const Carousel = forwardRef<
slidesToShow = 5,
centerMode,
pagination,
...props
},
ref
) => {
Expand All @@ -110,19 +108,14 @@ export const Carousel = forwardRef<
() =>
Children.map(children, (child, index) => {
return (
<SwiperSlide
style={props.variableWidth ? { width: "auto" } : {}}
key={index}
>
<SwiperSlide className="w-full" key={index}>
{child}
</SwiperSlide>
);
}),
[children, props.variableWidth]
[children]
);

const stylesWithTheme = useWithTheme();

const [swiper, setSwiper] = useState<SwiperClass | undefined>(undefined);
useImperativeHandle(ref, () => swiper, [swiper]);

Expand All @@ -147,7 +140,7 @@ export const Carousel = forwardRef<
}

return (
<div className={cn(stylesWithTheme(defaultStyles), className)}>
<div className={cn("flex", className)}>
<PrevArrow ref={prevRef} />
<Swiper
onSwiper={setSwiper}
Expand All @@ -156,13 +149,14 @@ export const Carousel = forwardRef<
effect={effect}
centeredSlides={centerMode}
spaceBetween={8}
slidesPerView={props.variableWidth ? "auto" : slidesToShow}
slidesPerView={slidesToShow}
navigation={{
nextEl: nextRef.current,
prevEl: prevRef.current,
}}
onInit={onInit}
modules={[Pagination, Navigation]}
className="w-[320px] overflow-y-auto"
>
{childrenComputed}
</Swiper>
Expand Down
75 changes: 0 additions & 75 deletions packages/graph-explorer/src/components/Chip/Chip.styles.ts

This file was deleted.

Loading
Loading