-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add selects. Add add-on profile for using the widgets in default Volto.
- Loading branch information
Showing
13 changed files
with
736 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import { Container } from 'semantic-ui-react'; | ||
import { SelectWidgetComponent as SelectWidget } from '../Select/SelectWidget'; | ||
import Input from '../Input/Input'; | ||
|
||
const DesignSystem = () => { | ||
return ( | ||
<Container> | ||
<div style={{ width: '300px' }}> | ||
<SelectWidget | ||
id="SelectWidget" | ||
title="Select Field" | ||
choices={[ | ||
['Foo', 'Foo'], | ||
['Bar', 'Bar'], | ||
['Foo', 'Foo'], | ||
]} | ||
description="Optional help text" | ||
placeholder="Type something…" | ||
/> | ||
</div> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default DesignSystem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import React from 'react'; | ||
import loadable from '@loadable/component'; | ||
|
||
import { Icon } from '@plone/volto/components'; | ||
|
||
import downSVG from '@plone/volto/icons/down-key.svg'; | ||
import upSVG from '@plone/volto/icons/up-key.svg'; | ||
import checkSVG from '@plone/volto/icons/check.svg'; | ||
|
||
const ReactSelect = loadable.lib(() => import('react-select')); | ||
|
||
export const Option = (props) => { | ||
return ( | ||
<ReactSelect> | ||
{({ components }) => ( | ||
<components.Option {...props}> | ||
<div className="label">{props.label}</div> | ||
{/* {props.isFocused && !props.isSelected && ( | ||
<Icon name={checkSVG} size="24px" color="#b8c6c8" /> | ||
)} | ||
{props.isSelected && ( | ||
<Icon name={checkSVG} size="24px" color="#007bc1" /> | ||
)} */} | ||
</components.Option> | ||
)} | ||
</ReactSelect> | ||
); | ||
}; | ||
|
||
export const DropdownIndicator = (props) => { | ||
return ( | ||
<ReactSelect> | ||
{({ components }) => ( | ||
<components.DropdownIndicator {...props}> | ||
{props.selectProps.menuIsOpen ? ( | ||
<Icon name={upSVG} size="18px" color="#007bc1" /> | ||
) : ( | ||
<Icon name={downSVG} size="18px" color="#007bc1" /> | ||
)} | ||
</components.DropdownIndicator> | ||
)} | ||
</ReactSelect> | ||
); | ||
}; | ||
|
||
export const selectTheme = (theme) => ({ | ||
...theme, | ||
colors: { | ||
...theme.colors, | ||
primary25: 'hotpink', | ||
primary: '#b8c6c8', | ||
}, | ||
}); | ||
|
||
export const customSelectStyles = { | ||
control: (styles, state) => ({ | ||
...styles, | ||
backgroundColor: state.isFocused ? '#fff !important' : null, | ||
boxShadow: state.isFocused ? 'inset 0 0 0 3px #349ef4 !important' : null, | ||
outline: 0, | ||
}), | ||
input: (styles, state) => ({ | ||
...styles, | ||
padding: 0, | ||
margin: 0, | ||
}), | ||
menu: (styles, state) => ({ | ||
...styles, | ||
top: null, | ||
marginTop: 0, | ||
zIndex: 2, | ||
backgroundColor: '#FFFFFF', | ||
boxShadow: | ||
'0px 3px 6px rgba(2, 19, 34, 0.12), 0px 2px 4px rgba(2, 19, 34, 0.06)', | ||
borderRadius: '6px', | ||
}), | ||
indicatorSeparator: (styles) => ({ | ||
...styles, | ||
width: null, | ||
}), | ||
valueContainer: (styles) => ({ | ||
...styles, | ||
padding: 0, | ||
}), | ||
dropdownIndicator: (styles) => ({ | ||
paddingRight: 0, | ||
maxHeight: '21px', | ||
display: 'flex', | ||
}), | ||
option: (styles, state) => ({ | ||
...styles, | ||
backgroundColor: state.isSelected ? '#d2d9df' : null, | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
padding: '12px 12px', | ||
color: state.isSelected | ||
? '#007bc1' | ||
: state.isFocused | ||
? '#4a4a4a' | ||
: 'inherit', | ||
':active': { | ||
backgroundColor: null, | ||
}, | ||
svg: { | ||
flex: '0 0 auto', | ||
}, | ||
}), | ||
}; |
Oops, something went wrong.