Skip to content

Commit 9ca7873

Browse files
committed
Change icon for collapse in isExpanded on video grid - rethink
1 parent 6e66251 commit 9ca7873

File tree

2 files changed

+38
-12
lines changed

2 files changed

+38
-12
lines changed

src/components/downloaded/downloaded-file.tsx

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
EllipsisVerticalIcon,
2121
PlayIcon,
2222
Trash2Icon,
23+
XIcon,
2324
} from "lucide-react";
2425

2526
import { Img } from "react-image";
@@ -34,7 +35,8 @@ interface DowloadedFileProps {
3435
selectedFile?: string;
3536
isDeleting?: string;
3637
isExpanded: boolean;
37-
onToggleExpand: () => void;
38+
onToggleExpand: () => void
39+
onCollapse: () => void
3840
}
3941

4042
export const DowloadedFile: FC<DowloadedFileProps> = (props) => {
@@ -46,6 +48,7 @@ export const DowloadedFile: FC<DowloadedFileProps> = (props) => {
4648
isDeleting,
4749
isExpanded,
4850
onToggleExpand,
51+
onCollapse,
4952
} = props;
5053

5154
const { apiBase } = useApiBase();
@@ -121,12 +124,32 @@ export const DowloadedFile: FC<DowloadedFileProps> = (props) => {
121124
</LongPressButton>
122125
);
123126

124-
const MoreButtonControl = () => (
125-
<EllipsisVerticalIcon
126-
style={thinIconStyle}
127-
onClick={onToggleExpand}
128-
className={cn(roundButtonClasses, "cursor-pointer w-10 h-10")}
129-
/>
127+
const ExpandControls = () => (
128+
<EllipsisVerticalIcon
129+
style={thinIconStyle}
130+
onClick={onToggleExpand}
131+
className={
132+
cn(
133+
roundButtonClasses,
134+
"cursor-pointer w-10 h-10",
135+
)
136+
}
137+
/>
138+
);
139+
140+
const CollapseControls = () => (
141+
<XIcon
142+
style={thinIconStyle}
143+
onClick={onCollapse}
144+
className={
145+
cn(
146+
roundButtonClasses,
147+
"cursor-pointer w-10 h-10",
148+
'border-[0.5px] border-foreground',
149+
'hover:bg-foreground/30 transition-colors duration-500'
150+
)
151+
}
152+
/>
130153
);
131154

132155
if (!isExpanded) {
@@ -141,7 +164,7 @@ export const DowloadedFile: FC<DowloadedFileProps> = (props) => {
141164
<PlayButtonControl />
142165
<DownloadButtonControl />
143166
<DeleteButtonControl />
144-
<MoreButtonControl />
167+
<ExpandControls />
145168
</div>
146169
</div>
147170
);
@@ -160,10 +183,9 @@ export const DowloadedFile: FC<DowloadedFileProps> = (props) => {
160183
<PlayButtonControl />
161184
<DownloadButtonControl />
162185
<DeleteButtonControl />
163-
<MoreButtonControl /> {/* This now closes it */}
186+
<CollapseControls />
164187
</div>
165188
</div>
166-
167189
</div>
168190
</div>
169191
);

src/components/downloaded/downloaded-ui.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ const DownloadedFilteredBySearch: FC<DownloadedFilteredBySearchProps> = ({
167167
const listClasses = "flex flex-col justify-items"
168168
const gridClasses = "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4"
169169
return (
170-
171170
<div className={viewType == 'grid' ? gridClasses : listClasses} >
172171
{
173172
searchResults(searchQuery).map((file, idx) => (
@@ -178,7 +177,12 @@ const DownloadedFilteredBySearch: FC<DownloadedFilteredBySearchProps> = ({
178177
isDeleting={isDeleting}
179178
isExpanded={expandedIndex === idx}
180179
onToggleExpand={() => {
181-
setExpandedIndex( (prev) => {
180+
setExpandedIndex((prev) => {
181+
return prev === idx ? null : idx
182+
})
183+
}}
184+
onCollapse={() => {
185+
setExpandedIndex((prev) => {
182186
return prev === idx ? null : idx
183187
})
184188
}}

0 commit comments

Comments
 (0)