Skip to content

Commit 3f912af

Browse files
committed
Refactor RandomMemeDetails component for improved readability
- Removed redundant imports and organized icon imports from lucide-react. - Simplified conditional rendering for meme type icons. - Enhanced formatting of text elements for better consistency and readability.
1 parent 0603c10 commit 3f912af

File tree

1 file changed

+32
-22
lines changed

1 file changed

+32
-22
lines changed

src/Site/Pages/RandomMemePage/components/RandomMemeDetails.tsx

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import React from "react";
1+
import {
2+
ArrowLeft,
3+
Edit,
4+
Folder,
5+
Image,
6+
RefreshCw,
7+
Trash2,
8+
} from "lucide-react";
29
import {
310
Alert,
411
Badge,
@@ -9,14 +16,6 @@ import {
916
Row,
1017
Spinner,
1118
} from "react-bootstrap";
12-
import {
13-
ArrowLeft,
14-
Edit,
15-
Folder,
16-
Image,
17-
RefreshCw,
18-
Trash2,
19-
} from "lucide-react";
2019

2120
import { RandomMemeDetailsProps } from "../RandomMemePage.types";
2221

@@ -78,11 +77,7 @@ const RandomMemeDetails: React.FC<RandomMemeDetailsProps> = ({
7877
</Button>
7978
<div>
8079
<h1 className="d-flex align-items-center gap-3 mb-1">
81-
{isType ? (
82-
<Folder size={32} />
83-
) : (
84-
<Image size={32} />
85-
)}
80+
{isType ? <Folder size={32} /> : <Image size={32} />}
8681
{isType ? "Тип мема" : "Заказ мема"}
8782
</h1>
8883
<p className="text-muted mb-0">
@@ -149,7 +144,9 @@ const RandomMemeDetails: React.FC<RandomMemeDetailsProps> = ({
149144
<>
150145
<Col sm={6}>
151146
<div className="border rounded p-3">
152-
<small className="text-muted d-block mb-1">Название</small>
147+
<small className="text-muted d-block mb-1">
148+
Название
149+
</small>
153150
<div className="fw-bold">{memeType!.name}</div>
154151
</div>
155152
</Col>
@@ -166,7 +163,9 @@ const RandomMemeDetails: React.FC<RandomMemeDetailsProps> = ({
166163
<>
167164
<Col sm={6}>
168165
<div className="border rounded p-3">
169-
<small className="text-muted d-block mb-1">Порядок</small>
166+
<small className="text-muted d-block mb-1">
167+
Порядок
168+
</small>
170169
<div className="fw-bold">#{memeOrder!.order}</div>
171170
</div>
172171
</Col>
@@ -236,7 +235,9 @@ const RandomMemeDetails: React.FC<RandomMemeDetailsProps> = ({
236235
<Row className="g-3">
237236
<Col md={6}>
238237
<div className="border rounded p-3">
239-
<small className="text-muted d-block mb-1">Название типа</small>
238+
<small className="text-muted d-block mb-1">
239+
Название типа
240+
</small>
240241
<div className="fw-bold">{memeOrder!.type.name}</div>
241242
</div>
242243
</Col>
@@ -248,7 +249,9 @@ const RandomMemeDetails: React.FC<RandomMemeDetailsProps> = ({
248249
</Col>
249250
<Col md={12}>
250251
<div className="border rounded p-3">
251-
<small className="text-muted d-block mb-1">Папка типа</small>
252+
<small className="text-muted d-block mb-1">
253+
Папка типа
254+
</small>
252255
<code className="bg-light px-2 py-1 rounded">
253256
{memeOrder!.type.folderPath}
254257
</code>
@@ -273,15 +276,20 @@ const RandomMemeDetails: React.FC<RandomMemeDetailsProps> = ({
273276
<Row className="g-3">
274277
<Col md={6}>
275278
<div className="border rounded p-3">
276-
<small className="text-muted d-block mb-1">Расширение</small>
279+
<small className="text-muted d-block mb-1">
280+
Расширение
281+
</small>
277282
<div className="fw-bold">
278-
{memeOrder!.filePath.split('.').pop()?.toUpperCase() || 'N/A'}
283+
{memeOrder!.filePath.split(".").pop()?.toUpperCase() ||
284+
"N/A"}
279285
</div>
280286
</div>
281287
</Col>
282288
<Col md={6}>
283289
<div className="border rounded p-3">
284-
<small className="text-muted d-block mb-1">Размер файла</small>
290+
<small className="text-muted d-block mb-1">
291+
Размер файла
292+
</small>
285293
<div className="fw-bold text-muted">Недоступно</div>
286294
<small className="text-muted">
287295
Информация о размере файла недоступна через API
@@ -290,7 +298,9 @@ const RandomMemeDetails: React.FC<RandomMemeDetailsProps> = ({
290298
</Col>
291299
<Col md={12}>
292300
<div className="border rounded p-3">
293-
<small className="text-muted d-block mb-1">Полный путь</small>
301+
<small className="text-muted d-block mb-1">
302+
Полный путь
303+
</small>
294304
<code className="bg-light px-2 py-1 rounded d-block text-break">
295305
{memeOrder!.filePath}
296306
</code>

0 commit comments

Comments
 (0)