Skip to content

Commit 7e8df91

Browse files
committed
update available drives component
1 parent 0ccb108 commit 7e8df91

File tree

2 files changed

+51
-52
lines changed

2 files changed

+51
-52
lines changed

src/plugins/drivelistmanager.tsx

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -57,43 +57,44 @@ interface ISearchListProps {
5757

5858
export function DriveSearchListComponent(props: ISearchListProps) {
5959
return (
60-
<div className="drive-search-list">
61-
<div className="row">
62-
<div className="column">
63-
<Search
64-
className="drive-search-input"
65-
onInput={(event: any) => props.setValue(event.target.value)}
66-
/>
67-
</div>
68-
<div className="column"></div>
60+
<>
61+
<Search
62+
className="drive-search-input"
63+
onInput={(event: any) => props.setValue(event.target.value)}
64+
placeholder="Search drive name"
65+
/>
66+
<div className="drive-search-list">
67+
{props.availableDrives.length === 0 ? (
68+
<div className="drives-manager-header-info">
69+
{'No available drives.'}
70+
</div>
71+
) : (
72+
props.availableDrives
73+
.filter(item => {
74+
return (
75+
item.name!.toLowerCase().indexOf(props.value.toLowerCase()) !==
76+
-1
77+
);
78+
})
79+
.map((drive, index) => (
80+
<li key={index}>
81+
<div className="available-drives-section">
82+
<div>{drive.name} </div>
83+
<Button
84+
className="search-add-drive-button"
85+
onClick={async () => {
86+
await includeDrive(drive.name!);
87+
await props.model.refresh();
88+
}}
89+
>
90+
add
91+
</Button>
92+
</div>
93+
</li>
94+
))
95+
)}
6996
</div>
70-
{props.availableDrives
71-
.filter(item => {
72-
return (
73-
item.name!.toLowerCase().indexOf(props.value.toLowerCase()) !== -1
74-
);
75-
})
76-
.map((drive, index) => (
77-
<li key={index}>
78-
<div className="row">
79-
<div className="column">
80-
<div>{drive.name} </div>
81-
</div>
82-
<div className="column">
83-
<Button
84-
className="input-add-drive-button"
85-
onClick={async () => {
86-
await includeDrive(drive.name!);
87-
await props.model.refresh();
88-
}}
89-
>
90-
add
91-
</Button>
92-
</div>
93-
</div>
94-
</li>
95-
))}
96-
</div>
97+
</>
9798
);
9899
}
99100
interface IDriveDataGridProps {

style/base.css

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,12 @@ li {
1111
list-style-type: none;
1212
}
1313

14-
/* .two-column-grid {
15-
display: grid;
16-
grid-template-columns: repeat(2, 1fr);
17-
gap: 0.6rem;
18-
margin-top: 10px;
19-
} */
20-
21-
/* Clear floats after the columns */
22-
23-
/* .row::after {
24-
content: '';
25-
display: table;
26-
clear: both;
27-
} */
28-
2914
.drive-search-list {
30-
width: auto;
15+
display: flex;
16+
width: 380px;
17+
flex-direction: column;
18+
align-items: center;
19+
gap: 0.2rem;
3120
}
3221

3322
.drive-list-manager {
@@ -144,3 +133,12 @@ li {
144133
.drives-section-title {
145134
font-weight: 500;
146135
}
136+
137+
.available-drives-section {
138+
display: flex;
139+
width: 370px;
140+
height: 24px;
141+
flex-direction: row;
142+
align-items: center;
143+
justify-content: space-between;
144+
}

0 commit comments

Comments
 (0)