Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

new multiselect

Maksim Mrugfae6203ba70e
diff --git a/app/routes/projects.settings.$id.tsx b/app/routes/projects.settings.$id.tsx
index 8665e5159..cae2cfe22 100644
--- a/app/routes/projects.settings.$id.tsx
+++ b/app/routes/projects.settings.$id.tsx
@@ -1,4 +1,12 @@
import ProjectSettings from 'pages/Project/Settings'
+import type { LinksFunction } from '@remix-run/node'
+import ProjectSettingsStyle from 'styles/ProjectSettings.css'
+
+export const links: LinksFunction = () => {
+ return [
+ { rel: 'stylesheet', href: ProjectSettingsStyle },
+ ]
+}
export default function Index() {
return <ProjectSettings />
diff --git a/app/styles/ProjectSettings.css b/app/styles/ProjectSettings.css
new file mode 100644
index 000000000..94648064b
--- /dev/null
+++ b/app/styles/ProjectSettings.css
@@ -0,0 +1,109 @@
+/* Container style */
+.multiselect-container {
+ position: relative;
+}
+
+/* Control style */
+.multiselect__control {
+ display: flex;
+ align-items: center;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+ padding: 8px;
+ background-color: #fff;
+ font-family: Arial, sans-serif;
+ font-size: 14px;
+ color: #333;
+ box-shadow: none;
+ transition: border-color 0.3s, box-shadow 0.3s;
+}
+
+.multiselect__control:hover {
+ border-color: #aaa;
+}
+
+.multiselect__control--is-focused {
+ border-color: #aaa;
+ box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
+ outline: none;
+}
+
+/* Placeholder style */
+.multiselect__placeholder {
+ color: #999;
+}
+
+/* Value style */
+.multiselect__single-value {
+ color: #333;
+}
+
+/* Dropdown style */
+.multiselect__menu {
+ position: absolute;
+ z-index: 1;
+ background-color: #fff;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
+ font-family: Arial, sans-serif;
+ font-size: 14px;
+ color: #333;
+ max-height: 200px;
+ overflow-y: auto;
+}
+
+/* Option style */
+.multiselect__option {
+ padding: 8px 12px;
+ cursor: pointer;
+ transition: background-color 0.3s;
+}
+
+.multiselect__option:hover {
+ background-color: #f0f0f0;
+}
+
+.multiselect__option--is-selected {
+ background-color: #f0f0f0;
+}
+
+/* Clear Indicator style */
+.multiselect__clear-indicator {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 0 4px;
+ color: #999;
+ cursor: pointer;
+}
+
+.multiselect__clear-indicator:hover {
+ color: #666;
+}
+
+/* Dropdown Indicator style */
+.multiselect__dropdown-indicator {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 0 4px;
+ color: #999;
+ cursor: pointer;
+}
+
+.multiselect__dropdown-indicator:hover {
+ color: #666;
+}
+
+/* Disabled style */
+.multiselect__control--is-disabled {
+ background-color: #f9f9f9;
+ color: #ccc;
+ cursor: not-allowed;
+}
+
+.multiselect__option--is-disabled {
+ color: #ccc;
+ cursor: not-allowed;
+}
diff --git a/app/ui/MultiSelect.tsx b/app/ui/MultiSelect.tsx
index d5a9e8688..105ac71ec 100644
--- a/app/ui/MultiSelect.tsx
+++ b/app/ui/MultiSelect.tsx
@@ -1,28 +1,29 @@
import React from 'react'
-import { MultiSelect } from 'react-multi-select-component'
+import Select from 'react-select'
const Multiselect = ({ items, selected, onSelect }: {
items: {
- label: string,
- value: string,
- disabled?: boolean,
- key?: string,
+ value: string | number,
+ label: string | number,
}[],
selected: {
- label: string,
- value: string,
+ value: string | number,
+ label: string | number,
}[],
- onSelect: (i: {
- label: string,
- value: string,
- }[]) => void,
+ onSelect: (item: {
+ value: string | number,
+ label: string | number,
+ }) => void,
}) => (
- <MultiSelect
+ <Select
+ isMulti
+ isSearchable
+ // className='inline-flex w-full rounded-md border border-gray-300 shadow-sm px-3 md:px-4 py-2 bg-white text-sm font-medium text-gray-700 dark:text-gray-50 dark:border-gray-800 dark:bg-slate-800 hover:bg-gray-50 dark:hover:bg-slate-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-indigo-500'
+ classNamePrefix='multiselect'
options={items}
value={selected}
+ // @ts-ignore
onChange={onSelect}
- labelledBy='Select'
- isCreatable
/>
)
diff --git a/package.json b/package.json
index 2cd2645b5..d787b335e 100644
--- a/package.json
+++ b/package.json
@@ -54,7 +54,6 @@
"react-flagkit": "^2.0.4",
"react-flatpickr": "^3.10.13",
"react-i18next": "^12.3.1",
- "react-multi-select-component": "4.3.2",
"react-outside-click-handler": "^1.3.0",
"react-qr-code": "^2.0.11",
"react-redux": "^8.1.0",