diff --git a/docs/src/pages/components/autocomplete/CustomizedHook.js b/docs/src/pages/components/autocomplete/CustomizedHook.js new file mode 100644 index 00000000000000..eb0e08e8e71f81 --- /dev/null +++ b/docs/src/pages/components/autocomplete/CustomizedHook.js @@ -0,0 +1,275 @@ +/* eslint-disable no-use-before-define */ +import React from 'react'; +import useAutocomplete from '@material-ui/lab/useAutocomplete'; +import CheckIcon from '@material-ui/icons/Check'; +import CloseIcon from '@material-ui/icons/Close'; +import styled from 'styled-components'; + +const Label = styled('label')` + padding: 0 0 4px; + line-height: 1.5; + display: block; +`; + +const InputWrapper = styled('div')` + width: 300px; + border: 1px solid #d9d9d9; + background-color: #fff; + border-radius: 4px; + padding: 1px; + display: flex; + flex-wrap: wrap; + + &:hover { + border-color: #40a9ff; + } + + &.focused { + border-color: #40a9ff; + box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2); + } + + & input { + font-size: 14px; + line-height: 26px; + padding: 2px 6px; + flex-grow: 1; + border: 0; + outline: 0; + } +`; + +const Tag = styled(({ label, onDelete, ...props }) => ( +