Skip to content

Commit

Permalink
fix: fliter list item clear button alignment fix (#2741)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolsinghbhatia authored Nov 9, 2023
1 parent 4469814 commit c291ff0
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const AppliedDateFilters: React.FC<Props> = observer((props) => {
};

return (
<div className="flex items-center gap-1 flex-wrap">
<>
{values.map((date) => (
<div key={date} className="text-xs flex items-center gap-1 bg-custom-background-80 p-1 rounded">
<span className="normal-case">{getDateLabel(date)}</span>
Expand All @@ -49,6 +49,6 @@ export const AppliedDateFilters: React.FC<Props> = observer((props) => {
</button>
</div>
))}
</div>
</>
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -50,50 +50,55 @@ export const AppliedFiltersList: React.FC<Props> = observer((props) => {
className="capitalize py-1 px-2 border border-custom-border-200 rounded-md flex items-center gap-2 flex-wrap"
>
<span className="text-xs text-custom-text-300">{replaceUnderscoreIfSnakeCase(filterKey)}</span>
{membersFilters.includes(filterKey) && (
<AppliedMembersFilters
handleRemove={(val) => handleRemoveFilter(filterKey, val)}
members={members}
values={value}
/>
)}
{dateFilters.includes(filterKey) && (
<AppliedDateFilters handleRemove={(val) => handleRemoveFilter(filterKey, val)} values={value} />
)}
{filterKey === "labels" && (
<AppliedLabelsFilters
handleRemove={(val) => handleRemoveFilter("labels", val)}
labels={labels}
values={value}
/>
)}
{filterKey === "priority" && (
<AppliedPriorityFilters handleRemove={(val) => handleRemoveFilter("priority", val)} values={value} />
)}
{filterKey === "state" && states && (
<AppliedStateFilters
handleRemove={(val) => handleRemoveFilter("state", val)}
states={states}
values={value}
/>
)}
{filterKey === "state_group" && (
<AppliedStateGroupFilters handleRemove={(val) => handleRemoveFilter("state_group", val)} values={value} />
)}
{filterKey === "project" && (
<AppliedProjectFilters
handleRemove={(val) => handleRemoveFilter("project", val)}
projects={projects}
values={value}
/>
)}
<button
type="button"
className="grid place-items-center text-custom-text-300 hover:text-custom-text-200"
onClick={() => handleRemoveFilter(filterKey, null)}
>
<X size={12} strokeWidth={2} />
</button>
<div className="flex items-center gap-1 flex-wrap">
{membersFilters.includes(filterKey) && (
<AppliedMembersFilters
handleRemove={(val) => handleRemoveFilter(filterKey, val)}
members={members}
values={value}
/>
)}
{dateFilters.includes(filterKey) && (
<AppliedDateFilters handleRemove={(val) => handleRemoveFilter(filterKey, val)} values={value} />
)}
{filterKey === "labels" && (
<AppliedLabelsFilters
handleRemove={(val) => handleRemoveFilter("labels", val)}
labels={labels}
values={value}
/>
)}
{filterKey === "priority" && (
<AppliedPriorityFilters handleRemove={(val) => handleRemoveFilter("priority", val)} values={value} />
)}
{filterKey === "state" && states && (
<AppliedStateFilters
handleRemove={(val) => handleRemoveFilter("state", val)}
states={states}
values={value}
/>
)}
{filterKey === "state_group" && (
<AppliedStateGroupFilters
handleRemove={(val) => handleRemoveFilter("state_group", val)}
values={value}
/>
)}
{filterKey === "project" && (
<AppliedProjectFilters
handleRemove={(val) => handleRemoveFilter("project", val)}
projects={projects}
values={value}
/>
)}
<button
type="button"
className="grid place-items-center text-custom-text-300 hover:text-custom-text-200"
onClick={() => handleRemoveFilter(filterKey, null)}
>
<X size={12} strokeWidth={2} />
</button>
</div>
</div>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const AppliedLabelsFilters: React.FC<Props> = observer((props) => {
const { handleRemove, labels, values } = props;

return (
<div className="flex items-center gap-1 flex-wrap">
<>
{values.map((labelId) => {
const labelDetails = labels?.find((l) => l.id === labelId);

Expand All @@ -40,6 +40,6 @@ export const AppliedLabelsFilters: React.FC<Props> = observer((props) => {
</div>
);
})}
</div>
</>
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const AppliedMembersFilters: React.FC<Props> = observer((props) => {
const { handleRemove, members, values } = props;

return (
<div className="flex items-center gap-1 flex-wrap">
<>
{values.map((memberId) => {
const memberDetails = members?.find((m) => m.id === memberId);

Expand All @@ -35,6 +35,6 @@ export const AppliedMembersFilters: React.FC<Props> = observer((props) => {
</div>
);
})}
</div>
</>
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const AppliedPriorityFilters: React.FC<Props> = observer((props) => {
const { handleRemove, values } = props;

return (
<div className="flex items-center gap-1 flex-wrap">
<>
{values.map((priority) => (
<div key={priority} className="text-xs flex items-center gap-1 bg-custom-background-80 p-1 rounded">
<PriorityIcon
Expand All @@ -42,6 +42,6 @@ export const AppliedPriorityFilters: React.FC<Props> = observer((props) => {
</button>
</div>
))}
</div>
</>
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const AppliedProjectFilters: React.FC<Props> = observer((props) => {
const { handleRemove, projects, values } = props;

return (
<div className="flex items-center gap-1 flex-wrap">
<>
{values.map((projectId) => {
const projectDetails = projects?.find((p) => p.id === projectId);

Expand Down Expand Up @@ -44,6 +44,6 @@ export const AppliedProjectFilters: React.FC<Props> = observer((props) => {
</div>
);
})}
</div>
</>
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ export const ProjectViewAppliedFiltersRoot: React.FC = observer(() => {
states={projectStateStore.states?.[projectId?.toString() ?? ""]}
/>
{storedFilters && viewDetails && areFiltersDifferent(storedFilters, viewDetails.query_data ?? {}) && (
<Button variant="primary" size="sm" onClick={handleUpdateView}>
Update view
</Button>
<div className="flex items-center justify-center flex-shrink-0">
<Button variant="primary" size="sm" onClick={handleUpdateView}>
Update view
</Button>
</div>
)}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const AppliedStateGroupFilters: React.FC<Props> = observer((props) => {
const { handleRemove, values } = props;

return (
<div className="flex items-center gap-1 flex-wrap">
<>
{values.map((stateGroup) => (
<div key={stateGroup} className="text-xs flex items-center gap-1 bg-custom-background-80 p-1 rounded">
<StateGroupIcon stateGroup={stateGroup as TStateGroups} height="12px" width="12px" />
Expand All @@ -28,6 +28,6 @@ export const AppliedStateGroupFilters: React.FC<Props> = observer((props) => {
</button>
</div>
))}
</div>
</>
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const AppliedStateFilters: React.FC<Props> = observer((props) => {
const { handleRemove, states, values } = props;

return (
<div className="flex items-center gap-1 flex-wrap">
<>
{values.map((stateId) => {
const stateDetails = states?.find((s) => s.id === stateId);

Expand All @@ -36,6 +36,6 @@ export const AppliedStateFilters: React.FC<Props> = observer((props) => {
</div>
);
})}
</div>
</>
);
});

0 comments on commit c291ff0

Please sign in to comment.