-
-
Notifications
You must be signed in to change notification settings - Fork 765
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
feat: updated filters dropdown and created stories for it #3174
Open
devilkiller-ag
wants to merge
18
commits into
asyncapi:master
Choose a base branch
from
devilkiller-ag:update-filters-dropdown
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+364
−34
Open
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5eda3ab
updated filters dropdown in tools
devilkiller-ag 08ce480
Merge branch 'master' into update-filters-dropdown
devilkiller-ag 67023b9
added stories for filters dropdown
devilkiller-ag bf0d3c0
Merge branch 'master' into update-filters-dropdown
devilkiller-ag 5d83bdc
Merge branch 'master' into update-filters-dropdown
asyncapi-bot 8d2b79d
Merge branch 'master' into update-filters-dropdown
devilkiller-ag 88db099
Merge branch 'master' into update-filters-dropdown
devilkiller-ag bd3efbb
Merge branch 'master' into update-filters-dropdown
devilkiller-ag 09a5c76
Merge branch 'master' of https://github.com/asyncapi/website into upd…
devilkiller-ag 3d94fcd
Merge branch 'asyncapi:master' into update-filters-dropdown
devilkiller-ag 776008a
Merge branch 'asyncapi:master' into update-filters-dropdown
devilkiller-ag 1903c13
Merge branch 'master' of https://github.com/asyncapi/website into upd…
devilkiller-ag f501d55
fixed ci issue, and updated the design
devilkiller-ag 36dcfd3
Merge branch 'asyncapi:master' into update-filters-dropdown
devilkiller-ag 9971ea0
Merge branch 'master' into update-filters-dropdown
devilkiller-ag 50ea482
Merge branch 'asyncapi:master' into update-filters-dropdown
devilkiller-ag e4e5a7b
feat: shortened filters dropdown height and added functionality to pe…
devilkiller-ag ec9aa51
fix: lint issue
devilkiller-ag 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
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,75 @@ | ||
import { useArgs } from '@storybook/preview-api'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import type { Language, Technology } from '@/types/components/tools/ToolDataType'; | ||
|
||
import tags from '../../config/all-tags.json'; | ||
import FiltersDropdown from './FiltersDropdown'; | ||
|
||
const meta: Meta<typeof FiltersDropdown> = { | ||
title: 'Components/FiltersDropdown', | ||
component: FiltersDropdown, | ||
argTypes: { | ||
dataList: { | ||
control: false | ||
}, | ||
checkedOptions: { | ||
control: { | ||
type: 'object' | ||
} | ||
}, | ||
setCheckedOptions: { | ||
control: false | ||
} | ||
} | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof FiltersDropdown>; | ||
|
||
const Dropdown: Story = { | ||
args: { | ||
checkedOptions: [] | ||
}, | ||
|
||
render: (args) => { | ||
const [{ checkedOptions }, updateArgs] = useArgs(); | ||
|
||
const setCheckedOptions: React.Dispatch<React.SetStateAction<string[]>> = (newValue) => { | ||
if (typeof newValue === 'function') { | ||
const updatedValue = (newValue as (prevState: string[]) => string[])(checkedOptions); | ||
|
||
updateArgs({ checkedOptions: updatedValue }); | ||
} else { | ||
updateArgs({ checkedOptions: newValue }); | ||
} | ||
}; | ||
|
||
return <FiltersDropdown {...args} checkedOptions={checkedOptions} setCheckedOptions={setCheckedOptions} />; | ||
} | ||
}; | ||
|
||
const languageList = tags.languages as Language[]; | ||
|
||
export const LanguageDropdown: Story = { | ||
...Dropdown, | ||
|
||
args: { | ||
...Dropdown.args, | ||
dataList: languageList, | ||
checkedOptions: [] | ||
} | ||
}; | ||
|
||
const technologyList = tags.technologies as Technology[]; | ||
|
||
export const TechnologyDropdown: Story = { | ||
...Dropdown, | ||
|
||
args: { | ||
...Dropdown.args, | ||
dataList: technologyList, | ||
checkedOptions: [] | ||
} | ||
}; |
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Enhance accessibility and maintainability.
Several improvements could be made to the rendering logic: