Task Description
Refactor the components/EventListCard component(s) to use the shared DropDownButton across the files listed below. The goal is to remove direct Dropdown usages and legacy dropdown wrappers in these files.
Files to Edit/Create
⚠️ Due to recent refactoring, the locations of these screens and components may have changed to new sub-directories
src/components/EventListCard/Modal/Preview/EventListCardPreviewModal.tsx
src/components/EventCalender/Header/EventHeader.tsx
src/components/EventDashboardScreen/EventDashboardScreen.tsx
src/shared-components/EventForm/RecurrenceDropdown/RecurrenceDropdown.tsx
Extensive Sample Code
This sample code is only representative of what could be done. It is provided only to give a general outline. You will need to use your initiative and industry best practices to find a solution that is suitable for the application.
Before Code (Representative)
import { Dropdown } from 'react-bootstrap';
<Dropdown> ... </Dropdown>
After Code (Multiple Selection Options)
import React, { useState } from 'react';
import DropDownButton from 'shared-components/DropDownButton';
type Option = { value: string; label: string; disabled?: boolean };
const filterOptions: Option[] = [
{ value: 'all', label: 'All' },
{ value: 'active', label: 'Active' },
{ value: 'archived', label: 'Archived' },
];
const sortOptions: Option[] = [
{ value: 'newest', label: 'Newest' },
{ value: 'oldest', label: 'Oldest' },
{ value: 'popular', label: 'Most Popular' },
];
const actionOptions: Option[] = [
{ value: 'edit', label: 'Edit' },
{ value: 'duplicate', label: 'Duplicate' },
{ value: 'share', label: 'Share' },
{ value: 'delete', label: 'Delete (disabled)', disabled: true }, // disabled option
];
export default function ExampleRefactor() {
const [filter, setFilter] = useState<string>('all');
const [sort, setSort] = useState<string>('newest');
const handleAction = (value: string) => {
// implement action switch if needed
};
return (
<div style={{ display: 'grid', gap: 12 }}>
<DropDownButton
options={filterOptions}
selectedValue={filter}
onSelect={setFilter}
ariaLabel="Filter items"
dataTestIdPrefix="filter"
variant="outline-secondary"
/>
<DropDownButton
options={sortOptions}
selectedValue={sort}
onSelect={setSort}
ariaLabel="Sort items"
dataTestIdPrefix="sort"
variant="outline-primary"
/>
<DropDownButton
options={actionOptions}
onSelect={handleAction}
ariaLabel="More actions"
dataTestIdPrefix="actions"
variant="outline-success"
buttonLabel="Actions"
/>
</div>
);
}
Acceptance Criteria
- Component/screen uses new shared DropDownButton component
- All existing functionality preserved
- All tests pass
- No TypeScript errors or warnings
- No ESLint errors or warnings
- Accessibility requirements met (ARIA labels, keyboard navigation)
- Visual appearance matches existing design
Testing Requirements
- Unit tests for component logic
- All tests must cover >= 95% of the submitted code
- All tests must be valid
- Integration tests for affected screens
- Visual regression tests (if applicable)
- Accessibility audit (WCAG 2.1 Level AA)
- Read our Testing Guide for guidance: https://docs-admin.talawa.io/docs/developer-resources/testing
- Pay special attention to:
- Pre-Commit Hooks
- Mock Isolation
CI/CD Section
- Edited files may not comply with the latest linting standards for the repository
- You will be responsible for ensuring that the code submitted meets these standards
Dependencies
Task Description
Refactor the components/EventListCard component(s) to use the shared DropDownButton across the files listed below. The goal is to remove direct Dropdown usages and legacy dropdown wrappers in these files.
Files to Edit/Create
src/components/EventListCard/Modal/Preview/EventListCardPreviewModal.tsxsrc/components/EventCalender/Header/EventHeader.tsxsrc/components/EventDashboardScreen/EventDashboardScreen.tsxsrc/shared-components/EventForm/RecurrenceDropdown/RecurrenceDropdown.tsxExtensive Sample Code
Before Code (Representative)
After Code (Multiple Selection Options)
Acceptance Criteria
Testing Requirements
CI/CD Section
Dependencies