Fix dropdown indicator

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2021-03-30 10:05:59 +02:00
parent d28c184daf
commit 48ab9bff46
8 changed files with 19 additions and 51 deletions

View File

@ -3,17 +3,18 @@ import ReactSelect, { components } from 'react-select';
import PropTypes from 'prop-types';
import Carret from '../Carret';
import { useTheme } from 'styled-components';
import DropdownIndicator from './DropdownIndicator';
import getStyles from './styles';
export const DropdownIndicator = props => {
const theme = useTheme();
// export const DropdownIndicator = props => {
// const theme = useTheme();
return (
<components.DropdownIndicator {...props}>
<Carret fill={theme.main.colors.grey} />
</components.DropdownIndicator>
);
};
// return (
// <components.DropdownIndicator {...props}>
// <Carret fill={theme.main.colors.grey} />
// </components.DropdownIndicator>
// );
// };
export const Select = ({ children, onChange, selectedValue, ...props }) => {
const theme = useTheme();

View File

@ -28,6 +28,8 @@ export { default as InputAddon } from './components/InputAddon';
export { default as EmptyState } from './components/EmptyState';
export * from './components/Tabs';
export * from './components/Select';
export { default as DropdownIndicator } from './components/Select/DropdownIndicator';
export * from './components/InjectionZone';
export { default as InputAddonWithErrors } from './components/InputAddonWithErrors';

View File

@ -56,6 +56,11 @@
"@buffetjs/icons": "3.3.5-next.1",
"@buffetjs/styles": "3.3.5-next.1",
"@buffetjs/utils": "3.3.5-next.1",
"@fortawesome/fontawesome-free": "^5.15.2",
"@fortawesome/fontawesome-svg-core": "^1.2.35",
"@fortawesome/free-brands-svg-icons": "^5.15.2",
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"@fortawesome/react-fontawesome": "^0.1.14",
"bootstrap": "^4.6.0",
"classnames": "^2.2.5",
"immutable": "^3.8.2",

View File

@ -1,39 +0,0 @@
import React from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Flex } from '@buffetjs/core';
import styled from 'styled-components';
import PropTypes from 'prop-types';
const Wrapper = styled(Flex)`
height: 100%;
width: 32px;
background: #fafafb;
> svg {
align-self: center;
font-size: 11px;
color: #b3b5b9;
}
`;
const DropdownIndicator = ({ selectProps: { menuIsOpen } }) => {
const icon = menuIsOpen ? 'caret-up' : 'caret-down';
return (
<Wrapper>
<FontAwesomeIcon icon={icon} />
</Wrapper>
);
};
DropdownIndicator.propTypes = {
selectProps: PropTypes.shape({
menuIsOpen: PropTypes.bool.isRequired,
}).isRequired,
};
Wrapper.defaultProps = {
flexDirection: 'column',
justifyContent: 'center',
};
export default DropdownIndicator;

View File

@ -4,6 +4,7 @@ import { FormattedMessage, useIntl } from 'react-intl';
import { Link, useLocation } from 'react-router-dom';
import { findIndex, get, isArray, isEmpty, set } from 'lodash';
import {
DropdownIndicator,
LabelIconWrapper,
NotAllowedInput,
request,
@ -16,7 +17,6 @@ import pluginId from '../../pluginId';
import SelectOne from '../SelectOne';
import SelectMany from '../SelectMany';
import ClearIndicator from './ClearIndicator';
import DropdownIndicator from './DropdownIndicator';
import IndicatorSeparator from './IndicatorSeparator';
import Option from './Option';
import { A, BaselineAlignment } from './components';

View File

@ -8,13 +8,13 @@ import { useTheme } from 'styled-components';
import { useIntl } from 'react-intl';
import {
BaselineAlignment,
DropdownIndicator,
ModalConfirm,
selectStyles,
useContentManagerEditViewDataManager,
request,
} from 'strapi-helper-plugin';
import { getTrad } from '../../utils';
import DropdownIndicator from '../DropdownIndicator';
import { cleanData, generateOptions } from './utils';
const CMEditViewCopyLocale = ({ appLocales, currentLocale, localizations, readPermissions }) => {

View File

@ -5,13 +5,12 @@ import get from 'lodash/get';
import Select, { components } from 'react-select';
import { useIntl } from 'react-intl';
import { useTheme } from 'styled-components';
import { BaselineAlignment, selectStyles } from 'strapi-helper-plugin';
import { DropdownIndicator, BaselineAlignment, selectStyles } from 'strapi-helper-plugin';
import { useHistory } from 'react-router-dom';
import { stringify } from 'qs';
import { getTrad } from '../../utils';
import { addStatusColorToLocale, createLocalesOption } from './utils';
import CMEditViewCopyLocale from '../CMEditViewCopyLocale';
import DropdownIndicator from '../DropdownIndicator';
import OptionComponent from './Option';
import Wrapper from './Wrapper';