Skip to content

Commit cc38746

Browse files
Schero94cursoragent
andcommitted
feat: modernize UI with Heroicons and improved modal design
- Replace @strapi/icons with Heroicons for better icon variety - Redesign CreateEditModal with collapsible sections - Add custom toggle switch for public bookmark setting - Fix documentId usage for Strapi v5 compatibility (delete, pin, update) - Add createdBy info to bookmarks for proper ownership display - Make MagicMark button compact (icon-only like settings gear) - Fix vertical text stacking in modal sections - Add isCurrentUserOwner helper for reliable ID comparison Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 4b1ab4c commit cc38746

10 files changed

Lines changed: 1651 additions & 664 deletions

File tree

admin/src/components/AdvancedFilterButton.tsx

Lines changed: 94 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,90 @@
11
// @ts-nocheck
22
import React, { useState, useEffect } from 'react';
3-
import { Button } from '@strapi/design-system';
4-
import { Filter, Check } from '@strapi/icons';
3+
import { Filter, Cross } from '@strapi/icons';
54
import { useNavigate, useLocation } from 'react-router-dom';
65
import { useFetchClient } from '@strapi/strapi/admin';
6+
import styled from 'styled-components';
77
import SimpleAdvancedFilterModal from './SimpleAdvancedFilterModal';
88

9+
// ================ STYLED COMPONENTS ================
10+
const FilterButtonGroup = styled.div`
11+
display: flex;
12+
align-items: center;
13+
gap: 6px;
14+
`;
15+
16+
const FilterButton = styled.button<{ $isActive?: boolean }>`
17+
display: inline-flex;
18+
align-items: center;
19+
justify-content: center;
20+
gap: 6px;
21+
height: 36px;
22+
padding: 0 14px;
23+
font-size: 13px;
24+
font-weight: 500;
25+
border: 1px solid ${props => props.$isActive ? '#4945FF' : '#dcdce4'};
26+
border-radius: 4px;
27+
background: ${props => props.$isActive
28+
? '#EEF0FF'
29+
: '#ffffff'};
30+
color: ${props => props.$isActive ? '#4945FF' : '#32324d'};
31+
cursor: pointer;
32+
transition: all 0.15s ease;
33+
white-space: nowrap;
34+
35+
&:hover {
36+
background: ${props => props.$isActive ? '#E0E7FF' : '#f6f6f9'};
37+
border-color: ${props => props.$isActive ? '#4945FF' : '#c0c0cf'};
38+
}
39+
40+
&:active {
41+
transform: scale(0.98);
42+
}
43+
44+
svg {
45+
width: 16px;
46+
height: 16px;
47+
flex-shrink: 0;
48+
}
49+
`;
50+
51+
const ClearButton = styled.button`
52+
display: inline-flex;
53+
align-items: center;
54+
justify-content: center;
55+
width: 36px;
56+
height: 36px;
57+
padding: 0;
58+
border: 1px solid #fecaca;
59+
border-radius: 4px;
60+
background: #fef2f2;
61+
color: #dc2626;
62+
cursor: pointer;
63+
transition: all 0.15s ease;
64+
65+
&:hover {
66+
background: #fee2e2;
67+
border-color: #fca5a5;
68+
}
69+
70+
&:active {
71+
transform: scale(0.98);
72+
}
73+
74+
svg {
75+
width: 16px;
76+
height: 16px;
77+
}
78+
`;
79+
80+
const ActiveDot = styled.span`
81+
width: 6px;
82+
height: 6px;
83+
background: #22c55e;
84+
border-radius: 50%;
85+
margin-left: 2px;
86+
`;
87+
988
const AdvancedFilterButton: React.FC = () => {
1089
const [showModal, setShowModal] = useState(false);
1190
const navigate = useNavigate();
@@ -204,24 +283,24 @@ const AdvancedFilterButton: React.FC = () => {
204283
};
205284

206285
return (
207-
<>
208-
<Button
209-
variant={hasActiveFilters ? 'default' : 'secondary'}
210-
startIcon={<Filter />}
286+
<FilterButtonGroup>
287+
<FilterButton
288+
$isActive={hasActiveFilters}
211289
onClick={() => setShowModal(true)}
212-
size="S"
290+
title="Open advanced filter builder"
213291
>
214-
{hasActiveFilters ? 'Filters Active' : 'Advanced Filters'}
215-
</Button>
292+
<Filter />
293+
Filters
294+
{hasActiveFilters && <ActiveDot />}
295+
</FilterButton>
216296

217297
{hasActiveFilters && (
218-
<Button
219-
variant="danger-light"
298+
<ClearButton
220299
onClick={handleClearFilters}
221-
size="S"
300+
title="Clear all filters"
222301
>
223-
Clear All
224-
</Button>
302+
<Cross />
303+
</ClearButton>
225304
)}
226305

227306
{showModal && (
@@ -233,7 +312,7 @@ const AdvancedFilterButton: React.FC = () => {
233312
currentQuery={getCurrentFilters()}
234313
/>
235314
)}
236-
</>
315+
</FilterButtonGroup>
237316
);
238317
};
239318

0 commit comments

Comments
 (0)