🔧 Added a placeholder for the actions menu
This commit is contained in:
@@ -6,7 +6,7 @@ import ComicVineSearchForm from "./ComicVineSearchForm";
|
|||||||
import AcquisitionPanel from "./AcquisitionPanel";
|
import AcquisitionPanel from "./AcquisitionPanel";
|
||||||
import DownloadsPanel from "./DownloadsPanel";
|
import DownloadsPanel from "./DownloadsPanel";
|
||||||
import SlidingPane from "react-sliding-pane";
|
import SlidingPane from "react-sliding-pane";
|
||||||
import Select from "react-select";
|
import Select, { components } from "react-select";
|
||||||
|
|
||||||
import { css } from "@emotion/react";
|
import { css } from "@emotion/react";
|
||||||
import "react-sliding-pane/dist/react-sliding-pane.css";
|
import "react-sliding-pane/dist/react-sliding-pane.css";
|
||||||
@@ -253,52 +253,29 @@ export const ComicDetail = ({}: ComicDetailProps): ReactElement => {
|
|||||||
// actions menu options and handler
|
// actions menu options and handler
|
||||||
const CVMatchLabel = (
|
const CVMatchLabel = (
|
||||||
<span>
|
<span>
|
||||||
<i className="fas fa-magic"></i> Match on ComicVine{" "}
|
<i className="fas fa-magic"></i> Match on ComicVine
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|
||||||
const editLabel = (
|
const editLabel = (
|
||||||
<span>
|
<span>
|
||||||
<i className="fas fa-pencil-alt"></i> Edit Metadata{" "}
|
<i className="fas fa-pencil-alt"></i> Edit Metadata
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
const deleteLabel = (
|
const deleteLabel = (
|
||||||
<span>
|
<span>
|
||||||
<i className="fas fa-trash-alt"></i> Delete Comic{" "}
|
<i className="fas fa-trash-alt"></i> Delete Comic
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
const customStyles = {
|
const Placeholder = (props) => {
|
||||||
control: base => ({
|
return <components.Placeholder {...props} />;
|
||||||
...base,
|
};
|
||||||
minHeight: 35
|
|
||||||
}),
|
|
||||||
dropdownIndicator: base => ({
|
|
||||||
...base,
|
|
||||||
padding: 4
|
|
||||||
}),
|
|
||||||
clearIndicator: base => ({
|
|
||||||
...base,
|
|
||||||
padding: 4
|
|
||||||
}),
|
|
||||||
multiValue: base => ({
|
|
||||||
...base,
|
|
||||||
backgroundColor: variables.colorPrimaryLighter
|
|
||||||
}),
|
|
||||||
valueContainer: base => ({
|
|
||||||
...base,
|
|
||||||
padding: '0px 6px'
|
|
||||||
}),
|
|
||||||
input: base => ({
|
|
||||||
...base,
|
|
||||||
margin: 0,
|
|
||||||
padding: 0
|
|
||||||
})
|
|
||||||
};
|
|
||||||
const actionOptions = [
|
const actionOptions = [
|
||||||
{ value: "match-on-comic-vine", label: CVMatchLabel },
|
{ value: "match-on-comic-vine", label: CVMatchLabel },
|
||||||
{ value: "edit-metdata", label: editLabel },
|
{ value: "edit-metdata", label: editLabel },
|
||||||
{ value: "delete-comic", label: deleteLabel },
|
{ value: "delete-comic", label: deleteLabel },
|
||||||
];
|
];
|
||||||
|
|
||||||
const handleActionSelection = (action) => {
|
const handleActionSelection = (action) => {
|
||||||
switch (action.value) {
|
switch (action.value) {
|
||||||
case "match-on-comic-vine":
|
case "match-on-comic-vine":
|
||||||
@@ -343,8 +320,13 @@ export const ComicDetail = ({}: ComicDetailProps): ReactElement => {
|
|||||||
<Select
|
<Select
|
||||||
className="basic-single"
|
className="basic-single"
|
||||||
classNamePrefix="select"
|
classNamePrefix="select"
|
||||||
defaultValue={actionOptions[0]}
|
components={{ Placeholder }}
|
||||||
name="color"
|
placeholder={
|
||||||
|
<span>
|
||||||
|
<i className="fas fa-list"></i> Actions
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
name="actions"
|
||||||
isSearchable={false}
|
isSearchable={false}
|
||||||
options={actionOptions}
|
options={actionOptions}
|
||||||
onChange={handleActionSelection}
|
onChange={handleActionSelection}
|
||||||
|
|||||||
Reference in New Issue
Block a user