-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #295 from Southclaws/datagraph-search-filters
Datagraph-search-filters
- Loading branch information
Showing
26 changed files
with
1,005 additions
and
477 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
14 changes: 14 additions & 0 deletions
14
web/src/api/openapi-schema/requiredSearchQueryParameter.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 @@ | ||
/** | ||
* Generated by orval v7.2.0 🍺 | ||
* Do not edit manually. | ||
* storyden | ||
* Storyden social API for building community driven platforms. | ||
The Storyden API does not adhere to semantic versioning but instead applies a rolling strategy with deprecations and minimal breaking changes. This has been done mainly for a simpler development process and it may be changed to a more fixed versioning strategy in the future. Ultimately, the primary way Storyden tracks versions is dates, there are no set release tags currently. | ||
* OpenAPI spec version: rolling | ||
*/ | ||
|
||
/** | ||
* Search query string. | ||
*/ | ||
export type RequiredSearchQueryParameter = string; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { SearchIcon } from "@/components/ui/icons/Search"; | ||
import { LinkButtonStyleProps } from "@/components/ui/link-button"; | ||
|
||
import { Anchor, AnchorProps, MenuItem } from "./Anchor"; | ||
|
||
export const SearchID = "search"; | ||
export const SearchRoute = "/search"; | ||
export const SearchLabel = "Search"; | ||
|
||
type Props = AnchorProps & LinkButtonStyleProps; | ||
|
||
export function SearchAnchor(props: Props) { | ||
return ( | ||
<Anchor | ||
id={SearchID} | ||
route={SearchRoute} | ||
label={SearchLabel} | ||
icon={<SearchIcon />} | ||
{...props} | ||
/> | ||
); | ||
} | ||
|
||
export function SearchMenuItem() { | ||
return ( | ||
<MenuItem | ||
id={SearchID} | ||
route={SearchRoute} | ||
label={SearchLabel} | ||
icon={<SearchIcon />} | ||
/> | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { Portal, ToggleGroupValueChangeDetails } from "@ark-ui/react"; | ||
import { JSX } from "react"; | ||
import { Controller, ControllerProps, FieldValues } from "react-hook-form"; | ||
|
||
import * as ToggleGroup from "@/components/ui/toggle-group"; | ||
import * as Tooltip from "@/components/ui/tooltip"; | ||
import { HStack } from "@/styled-system/jsx"; | ||
|
||
type CollectionItem = { | ||
label: string; | ||
icon: JSX.Element; | ||
description: string; | ||
value: string; | ||
}; | ||
|
||
type Props<T extends FieldValues> = Omit<ControllerProps<T>, "render"> & { | ||
items: CollectionItem[]; | ||
}; | ||
|
||
export function DatagraphKindFilterField<T extends FieldValues>({ | ||
items, | ||
...props | ||
}: Props<T>) { | ||
return ( | ||
<Controller<T> | ||
{...props} | ||
render={({ formState, field }) => { | ||
function handleChangeFilter({ value }: ToggleGroupValueChangeDetails) { | ||
field.onChange(value); | ||
} | ||
|
||
return ( | ||
<ToggleGroup.Root | ||
multiple | ||
size="xs" | ||
onValueChange={handleChangeFilter} | ||
defaultValue={formState.defaultValues?.[props.name]} | ||
> | ||
{items.map((item) => ( | ||
<ToggleGroup.Item | ||
key={item.value} | ||
value={item.value} | ||
aria-label={item.description} | ||
> | ||
<Tooltip.Root | ||
lazyMount | ||
openDelay={0} | ||
positioning={{ | ||
slide: true, | ||
shift: -48, | ||
placement: "right-end", | ||
}} | ||
> | ||
<Tooltip.Trigger asChild> | ||
<HStack gap="1"> | ||
{item.icon} {item.label} | ||
</HStack> | ||
</Tooltip.Trigger> | ||
|
||
<Portal> | ||
<Tooltip.Positioner> | ||
<Tooltip.Arrow> | ||
<Tooltip.ArrowTip /> | ||
</Tooltip.Arrow> | ||
|
||
<Tooltip.Content>{item.description}</Tooltip.Content> | ||
</Tooltip.Positioner> | ||
</Portal> | ||
</Tooltip.Root> | ||
</ToggleGroup.Item> | ||
))} | ||
</ToggleGroup.Root> | ||
); | ||
}} | ||
/> | ||
); | ||
} |
Oops, something went wrong.