1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 15:29:42 +02:00

refactor(portainer): move to react [EE-3350] (#7915)

This commit is contained in:
Chaim Lev-Ari 2022-11-13 10:10:18 +02:00 committed by GitHub
parent 30e23ea5b4
commit 78dcba614d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
192 changed files with 200 additions and 211 deletions

View file

@ -1,6 +1,6 @@
import { Search } from 'react-feather';
import { useLocalStorage } from '@/portainer/hooks/useLocalStorage';
import { useLocalStorage } from '@/react/hooks/useLocalStorage';
interface Props {
value: string;

View file

@ -2,7 +2,7 @@ import { Search } from 'react-feather';
import { useEffect, useMemo, useState } from 'react';
import _ from 'lodash';
import { useLocalStorage } from '@/portainer/hooks/useLocalStorage';
import { useLocalStorage } from '@/react/hooks/useLocalStorage';
import { AutomationTestingProps } from '@/types';
interface Props extends AutomationTestingProps {

View file

@ -1,26 +0,0 @@
.sort-by-container {
display: flex;
align-items: center;
justify-content: flex-end;
}
.sort-by-element {
display: inline-block;
}
.sort-button {
background-color: var(--bg-sortbutton-color);
color: var(--grey-6);
border: 1px solid var(--border-sortbutton);
display: inline-block;
padding: 8px 10px;
border-radius: 5px;
}
:global(:root[theme='dark']) .sort-button {
color: var(--white-color);
}
:global(:root[theme='highcontrast']) .sort-button {
color: var(--white-color);
}

View file

@ -1,66 +0,0 @@
import { useEffect, useState } from 'react';
import { Filter } from '@/portainer/home/types';
import { Select } from '@@/form-components/ReactSelect';
import styles from './SortbySelector.module.css';
interface Props {
filterOptions: Filter[];
onChange: (filterOptions: Filter) => void;
onDescending: () => void;
placeHolder: string;
sortByDescending: boolean;
sortByButton: boolean;
value?: Filter;
}
export function SortbySelector({
filterOptions,
onChange,
onDescending,
placeHolder,
sortByDescending,
sortByButton,
value,
}: Props) {
const upIcon = 'fa fa-sort-alpha-up';
const downIcon = 'fa fa-sort-alpha-down';
const [iconStyle, setIconStyle] = useState(downIcon);
useEffect(() => {
if (sortByDescending) {
setIconStyle(upIcon);
} else {
setIconStyle(downIcon);
}
}, [sortByDescending]);
return (
<div className={styles.sortByContainer}>
<div className={styles.sortByElement}>
<Select
placeholder={placeHolder}
options={filterOptions}
onChange={(option) => onChange(option as Filter)}
isClearable
value={value}
/>
</div>
<div className={styles.sortByElement}>
<button
className={styles.sortButton}
type="button"
disabled={!sortByButton}
onClick={(e) => {
e.preventDefault();
onDescending();
}}
>
<i className={iconStyle} />
</button>
</div>
</div>
);
}

View file

@ -8,7 +8,7 @@ import {
useState,
} from 'react';
import { useLocalStorage } from '@/portainer/hooks/useLocalStorage';
import { useLocalStorage } from '@/react/hooks/useLocalStorage';
interface TableSettingsContextInterface<T> {
settings: T;