-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c02e145
commit 04b48e4
Showing
5 changed files
with
44 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@shopify/polaris': minor | ||
--- | ||
|
||
Added new AlphaPicker component |
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 |
---|---|---|
|
@@ -55,6 +55,10 @@ export function DetailsPage() { | |
emailFieldValue: '[email protected]', | ||
nameFieldValue: 'Jaded Pixel', | ||
}); | ||
const [query, setQuery] = useState(''); | ||
const [vendors, setVendors] = useState([ | ||
{value: 'Burberry', children: 'Burberry'}, | ||
]); | ||
const skipToContentRef = useRef<HTMLAnchorElement>(null); | ||
const [toastActive, setToastActive] = useState(false); | ||
const [isLoading, setIsLoading] = useState(false); | ||
|
@@ -66,7 +70,7 @@ export function DetailsPage() { | |
const [modalActive, setModalActive] = useState(false); | ||
const [navItemActive, setNavItemActive] = useState('products'); | ||
const initialDescription = | ||
'The M60-A represents the benchmark and equilibrium between function and design for us at Rama Works. The gently exaggerated design of the frame is not understated, but rather provocative. Inspiration and evolution from previous models are evident in the beautifully articulated design and the well defined aesthetic, the fingerprint of our ‘Industrial Modern’ designs.'; | ||
'The M60-A represents the benchmark and equilibrium between function and design for us at Rama Works. The gently exaggerated design of the frame is not understated, but rather provocative. Inspiration and evolution from previous models are evident in the beautifully articulated design and the well defined aesthetic, the fingerprint of our ‘Industrial Modern’ designs. The M60-A represents the benchmark and equilibrium between function and design for us at Rama Works. The gently exaggerated design of the frame is not understated, but rather provocative. Inspiration and evolution from previous models are evasdfasdfident in the beautifully articulated design and the well defined aesthetic, the fingerprint of our ‘Industrial Modern’ designs.'; | ||
const [previewValue, setPreviewValue] = useState(initialDescription); | ||
const [nameFieldValue, setNameFieldValue] = useState( | ||
defaultState.current.nameFieldValue, | ||
|
@@ -80,6 +84,16 @@ export function DetailsPage() { | |
const [supportSubject, setSupportSubject] = useState(''); | ||
const [supportMessage, setSupportMessage] = useState(''); | ||
|
||
const handleSelect = (selected: string) => { | ||
setQuery(''); | ||
if (vendors.some((vendor) => vendor.children === selected)) return; | ||
|
||
setVendors((vendors) => [ | ||
...vendors, | ||
{value: selected, children: selected}, | ||
]); | ||
}; | ||
|
||
const handleDiscard = useCallback(() => { | ||
setEmailFieldValue(defaultState.current.emailFieldValue); | ||
setNameFieldValue(defaultState.current.nameFieldValue); | ||
|
@@ -625,58 +639,6 @@ export function DetailsPage() { | |
{fileUpload} | ||
</DropZone> | ||
</LegacyCard> | ||
<LegacyCard sectioned> | ||
<FormLayout> | ||
<TextField | ||
label="Title" | ||
value={title} | ||
onChange={(title) => { | ||
setTitle(title); | ||
setIsDirty(true); | ||
}} | ||
autoComplete="off" | ||
/> | ||
<TextField | ||
label="Description" | ||
value={descriptionValue} | ||
onChange={handleChange} | ||
autoComplete="off" | ||
multiline | ||
/> | ||
</FormLayout> | ||
</LegacyCard> | ||
<LegacyCard title="Media" sectioned> | ||
<DropZone onDrop={handleDropZoneDrop}> | ||
{uploadedFiles} | ||
{fileUpload} | ||
</DropZone> | ||
</LegacyCard> | ||
<LegacyCard sectioned> | ||
<FormLayout> | ||
<TextField | ||
label="Title" | ||
value={title} | ||
onChange={(title) => { | ||
setTitle(title); | ||
setIsDirty(true); | ||
}} | ||
autoComplete="off" | ||
/> | ||
<TextField | ||
label="Description" | ||
value={descriptionValue} | ||
onChange={handleChange} | ||
autoComplete="off" | ||
multiline | ||
/> | ||
</FormLayout> | ||
</LegacyCard> | ||
<LegacyCard title="Media" sectioned> | ||
<DropZone onDrop={handleDropZoneDrop}> | ||
{uploadedFiles} | ||
{fileUpload} | ||
</DropZone> | ||
</LegacyCard> | ||
</Layout.Section> | ||
<Layout.Section variant="oneThird"> | ||
<LegacyCard title="Organization"> | ||
|
@@ -696,21 +658,23 @@ export function DetailsPage() { | |
/> | ||
<br /> | ||
<AlphaPicker | ||
onSelect={handleSelect} | ||
activator={{ | ||
label: 'Tags', | ||
placeholder: 'Search tags', | ||
}} | ||
searchField={{ | ||
label: 'Search vendors', | ||
placeholder: 'Search vendors', | ||
autoComplete: 'off', | ||
value: query, | ||
onChange: (value) => setQuery(value), | ||
}} | ||
activator={{ | ||
label: 'Tags', | ||
placeholder: 'Search tags', | ||
options={vendors} | ||
addAction={{ | ||
value: query, | ||
children: `Add ${query}`, | ||
}} | ||
options={[ | ||
{ | ||
value: 'Burberry', | ||
children: 'Burberry', | ||
}, | ||
]} | ||
/> | ||
</LegacyCard.Section> | ||
<LegacyCard.Section title="Collections" /> | ||
|
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