-
Notifications
You must be signed in to change notification settings - Fork 1
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 #2476 from NDLANO/refactor/replace-async-tags-with…
…-tag-selector refactor: replace AsyncSearchTags with TagSelector
- Loading branch information
Showing
20 changed files
with
448 additions
and
254 deletions.
There are no files selected for viewing
133 changes: 0 additions & 133 deletions
133
src/components/Dropdown/asyncDropdown/AsyncSearchTags.tsx
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
src/components/Dropdown/asyncDropdown/__tests__/csv-tag-input-test.ts
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Copyright (c) 2024-present, NDLA. | ||
* | ||
* This source code is licensed under the GPLv3 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
import { forwardRef } from "react"; | ||
import { useTranslation } from "react-i18next"; | ||
import { ComboboxContent, ComboboxContentProps, ComboboxPositioner, Spinner, Text } from "@ndla/primitives"; | ||
|
||
interface Props extends ComboboxContentProps { | ||
isFetching: boolean; | ||
hits: number; | ||
} | ||
|
||
export const SearchTagsContent = forwardRef<HTMLDivElement, Props>(({ isFetching, hits, children, ...props }) => { | ||
const { t } = useTranslation(); | ||
return ( | ||
<ComboboxPositioner> | ||
<ComboboxContent {...props}> | ||
{isFetching ? <Spinner /> : hits ? children : <Text>{t("dropdown.numberHits", { hits: 0 })}</Text>} | ||
</ComboboxContent> | ||
</ComboboxPositioner> | ||
); | ||
}); |
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,44 @@ | ||
/** | ||
* Copyright (c) 2024-present, NDLA. | ||
* | ||
* This source code is licensed under the GPLv3 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
import { forwardRef } from "react"; | ||
import { CloseLine } from "@ndla/icons/action"; | ||
import { ArrowDownShortLine } from "@ndla/icons/common"; | ||
import { IconButton, InputContainer } from "@ndla/primitives"; | ||
import { HStack } from "@ndla/styled-system/jsx"; | ||
import { | ||
TagSelectorClearTrigger, | ||
TagSelectorControl, | ||
TagSelectorInput, | ||
TagSelectorTrigger, | ||
TagSelectorInputProps, | ||
} from "@ndla/ui"; | ||
|
||
interface Props extends TagSelectorInputProps {} | ||
|
||
export const SearchTagsTagSelectorInput = forwardRef<HTMLInputElement, Props>((props, ref) => { | ||
return ( | ||
<HStack gap="3xsmall"> | ||
<TagSelectorControl asChild> | ||
<InputContainer> | ||
<TagSelectorInput {...props} ref={ref} /> | ||
<TagSelectorClearTrigger asChild> | ||
<IconButton variant="clear"> | ||
<CloseLine /> | ||
</IconButton> | ||
</TagSelectorClearTrigger> | ||
</InputContainer> | ||
</TagSelectorControl> | ||
<TagSelectorTrigger asChild> | ||
<IconButton variant="secondary"> | ||
<ArrowDownShortLine /> | ||
</IconButton> | ||
</TagSelectorTrigger> | ||
</HStack> | ||
); | ||
}); |
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
Oops, something went wrong.