-
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.
Migration guide polish and examples (#10889)
Fixes #10806 1. Added support for `<details>` toggles on markdown 2. Added support for `collabsibleTOC` pages (off by default) so you can quickly skip to the section you need. This isn't perfect yet (doesn't auto open when linking directly to an anchor) but is much better than what we currently have 3. Organized v11 to v12 styleguide into consistent steps 4. Put regex validation, mapping tables, and examples in details toggles to make the page less overwhelming and put migration commands at the forefront 5. Added introduction, glossary, and generalized the migration workflow section. Put these at the top to introduce builders to the migration 6. Added descriptive titles to all component migrations naming what they do 7. Added examples to each component migration and removed them from the "Whats new" page 8. Added regex validation snippets to all component migrations 9. Added alert text for stepped migrations that have to be run in order 10. Cleaned up copy and overall improved migration experience giving more context on how and why we are running the migrations. Aimed to make it clear enough that an intern could run a migration on their code base 11. Add padding to code blocks ![toc-demo](https://github.com/Shopify/polaris/assets/20652326/c1b012b6-b576-405f-a69e-f7cc085d66f2) ![Screen Recording 2023-10-05 at 3 09 18 PM](https://github.com/Shopify/polaris/assets/20652326/4999bcbe-960b-4718-ba73-04963eeed302) --------- Co-authored-by: Lo Kim <[email protected]>
- Loading branch information
Showing
12 changed files
with
2,290 additions
and
828 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,3 @@ | ||
# Guides | ||
|
||
Migration guides for upgrading from v11 to v12 and onwards are hosted on our documentation site at https://polaris.shopify.com/version-guides. |
2,756 changes: 2,100 additions & 656 deletions
2,756
polaris.shopify.com/content/version-guides/migrating-from-v11-to-v12.md
Large diffs are not rendered by default.
Oops, something went wrong.
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
51 changes: 51 additions & 0 deletions
51
polaris.shopify.com/src/components/CollapsibleDetails/index.tsx
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,51 @@ | ||
import React, {useState} from 'react'; | ||
import {motion, AnimatePresence} from 'framer-motion'; | ||
import Icon from '../Icon'; | ||
import {CaretDownMinor} from '@shopify/polaris-icons'; | ||
|
||
export interface CollasibleDetailsProps { | ||
summary?: string | React.ReactNode; | ||
} | ||
export function CollapsibleDetails({ | ||
children, | ||
summary, | ||
}: React.PropsWithChildren<CollasibleDetailsProps>) { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
const toggleOpen = () => { | ||
setIsOpen(!isOpen); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<motion.summary | ||
style={{display: 'flex', margin: '0.5rem 0', cursor: 'pointer'}} | ||
onClick={toggleOpen} | ||
initial={false} | ||
> | ||
<motion.span | ||
style={{display: 'flex', maxHeight: '20px'}} | ||
initial={{rotate: -90}} | ||
animate={{rotate: isOpen ? 0 : -90}} | ||
exit={{rotate: -90}} | ||
transition={{ease: 'easeInOut', duration: 0.15}} | ||
> | ||
<Icon source={CaretDownMinor} /> | ||
</motion.span> | ||
{summary} | ||
</motion.summary> | ||
<AnimatePresence> | ||
{isOpen && ( | ||
<motion.div | ||
initial={{opacity: 0, height: 0}} | ||
animate={{opacity: 1, scale: 1, height: 'auto'}} | ||
exit={{opacity: 0, height: 0}} | ||
transition={{ease: 'easeInOut', duration: 0.15}} | ||
> | ||
{children} | ||
</motion.div> | ||
)} | ||
</AnimatePresence> | ||
</div> | ||
); | ||
} |
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
Oops, something went wrong.