From 3d845bd35dd65fa92750389c211b788daa3b0af8 Mon Sep 17 00:00:00 2001 From: Samuel Freiberg <32719011+samuelfreiberg@users.noreply.github.com> Date: Mon, 15 Nov 2021 10:24:57 -0700 Subject: [PATCH] Adding Some Missing Component Documentation (#1077) * Yarn * Merge * Fixing repo * Update package * Merge * Removing change file * Add Tabs + FocusZone documentation * Add Shimmer Documentation * Fixing documentation * Adding Callout documentation * MenuButton doc isn't created yet * Updating accessibilityPositionInSet and accessibilitySetSize props for RadioButton * Updating format of RadioGroup tokens to a table --- docs/pages/Components/Callout.md | 137 +++++++++++++++++++++++++++ docs/pages/Components/Callout.mdx | 1 - docs/pages/Components/FocusZone.md | 43 +++++++++ docs/pages/Components/MenuButton.mdx | 1 - docs/pages/Components/RadioGroup.md | 67 +++++++++++++ docs/pages/Components/RadioGroup.mdx | 39 -------- docs/pages/Components/Shimmer.md | 91 ++++++++++++++++++ docs/pages/Components/Tabs.md | 128 +++++++++++++++++++++++++ docs/pages/Components/Tabs.mdx | 66 ------------- 9 files changed, 466 insertions(+), 107 deletions(-) create mode 100644 docs/pages/Components/Callout.md delete mode 100644 docs/pages/Components/Callout.mdx create mode 100644 docs/pages/Components/FocusZone.md delete mode 100644 docs/pages/Components/MenuButton.mdx create mode 100644 docs/pages/Components/RadioGroup.md delete mode 100644 docs/pages/Components/RadioGroup.mdx create mode 100644 docs/pages/Components/Shimmer.md create mode 100644 docs/pages/Components/Tabs.md delete mode 100644 docs/pages/Components/Tabs.mdx diff --git a/docs/pages/Components/Callout.md b/docs/pages/Components/Callout.md new file mode 100644 index 000000000..d0e23949a --- /dev/null +++ b/docs/pages/Components/Callout.md @@ -0,0 +1,137 @@ +# Callout + +## Purpose + +A callout is an anchored tip that can be used to teach people or guide them through the app without blocking them. + +## Do's: + +- Place a callout near the object being described. At the pointer’s tail or head, if possible. + +## Don't: + +- Don't use large, unformatted blocks of text in your callout. They're difficult to read and overwhelming. +- Don’t block important UI with the placement of your callout. It's a poor user experience that will lead to frustration +- Don’t open a callout from within another callout. +- Don’t show callouts on hidden elements. +- Don’t overuse callouts. Too many callouts opening automatically can be perceived as interrupting someone's workflow. + +## Sample Code: + +### Rectangle Shimmer + +```jsx +const customCallout: React.FunctionComponent = () => { + const [showCustomizedCallout, setShowCustomizedCallout] = React.useState(false); + const [isCustomizedCalloutVisible, setIsCustomizedCalloutVisible] = React.useState(false); + + const toggleShowCustomizedCallout = React.useCallback(() => { + setShowCustomizedCallout(!showCustomizedCallout); + + // Unmounting a callout does not invoke onDismiss; onDismiss is only invoked + // for dismissals generated by the native app. When toggling to 'show', + // the isVisible state will be corrected to 'true' by the onShow callback. + setIsCustomizedCalloutVisible(false); + }, [showCustomizedCallout, setIsCustomizedCalloutVisible, setShowCustomizedCallout]); + + const onShowCustomizedCallout = React.useCallback(() => { + setIsCustomizedCalloutVisible(true); + }, [setIsCustomizedCalloutVisible]); + + const onDismissCustomizedCallout = React.useCallback(() => { + setIsCustomizedCalloutVisible(false); + + // setting the internal state to false will instigate unmounting the + // zombie Callout control. + setShowCustomizedCallout(false); + }, [setIsCustomizedCalloutVisible, setShowCustomizedCallout]); + + const myRect: ScreenRect = { screenX: 10, screenY: 10, width: 100, height: 100 }; + + return ( + + +