Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIxes > Various Docs site issues #1574

Merged
merged 13 commits into from
Nov 21, 2024
Merged

FIxes > Various Docs site issues #1574

merged 13 commits into from
Nov 21, 2024

Conversation

chris-cedrone-cengage
Copy link
Collaborator

Issue: # 1554

What I did

Cleaned up CodeSandbox examples for: Grid, Container, Stepper, Combobox, Hyperlink, IconButton, Toast, DatePicker, Dropdown, Form, FormGroup, & useFocusLock

Checklist

  • changeset has been added
  • Pull request description is descriptive
  • I have made corresponding changes to the documentation
  • New and existing unit tests pass locally with my changes
  • [N/A] I have added tests that prove my fix is effective or that my feature works

How to test

Go to: https://next--upbeat-sinoussi-f675aa.netlify.app/api/

1. Grid

Basic Usage example

2. Container

All examples

3. Stepper

Step label example

Completed Step Description example

4. Combobox

Label Position example

Async example

Custom Items example

5. Hyperlink

Icon example

6. IconButton

Basic Usage example

Inverse example

7. Toast

Toast Documentation

There are a couple items in the "Accessibility Considerations" section that need to be fixed.

The toast is displayed in the bottom-left corner of the window, not the center
"Where ever" should be "Wherever".

8. DatePicker

Default Date example

Value example

The description under Keyboard Navigation is no longer accurate now that we've removed ?
If you would like to see all of the options for keyboard navigation click on the ? button in the bottom right corner of the DatePicker or press the ? key. should be removed

9. Dropdown

DropdownSplitButton example

Custom DropdownMenuItem Wrappers example

Expandable Menu examples have a new bug so the CodeSandbox will still show the error with icon:

#1573

10. Form

Form Props should be heading 2 ## instead of 1 so it can show up on the side nav

11. FormGroup

Visually Hidden Label, Custom Styles and Labeling Form Groups all use name prop which is not needed

12. useFocusLock

Optional Header Without Focusable Element example (removed references of Input, Button, Heading)

Copy link

changeset-bot bot commented Nov 15, 2024

🦋 Changeset detected

Latest commit: a872661

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
react-magma-docs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

Copy link
Contributor

@chris-cedrone-cengage chris-cedrone-cengage marked this pull request as ready for review November 15, 2024 21:01
@silvalaura silvalaura linked an issue Nov 15, 2024 that may be closed by this pull request
Copy link
Collaborator

@silvalaura silvalaura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few outstanding issues:

Combobox:

  • Async: inputValue is declared but value is never read, 'items' is of type 'unknown'.
  • Custom Items Typescript: cannot find name uuid, Type '{ id: any; name: string; representation: string; }' is not assignable to type 'CustomComboboxItem'.
  • Custom Items: cannot find name uuid, Type '{ id: number; name: string; representation: string; hex: string; }' is not assignable to type '{ id: any; name: any; representation: any; }'.

Hyperlink:
image

IconButton:
https://docs-preview-1574--upbeat-sinoussi-f675aa.netlify.app/api/icon-button/ is broken

gridJustifyContent="center"
gridAlignItems="center"
gridJustifyContent={GridJustifyContent.center}
gridAlignItems={gridAlignItems.center}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gridAlignItems={gridAlignItems.center}
gridAlignItems={GridAlignItems.center}

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Collaborator

@silvalaura silvalaura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the first 6 items and found problems in 4/6. Please go over all 15 items in the ticket again and ensure they are all working before requesting a review.

  1. Grid 🚫
    image
  2. Container ✅
  3. Stepper ✅
  4. Combobox 🚫
    image
    image
    image
  5. Hyperlink 🚫
    image
  6. IconButton 🚫
    image

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Collaborator

@silvalaura silvalaura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Grid ✅
  2. Container ✅
  3. Stepper ✅
  4. Combobox ❌
    -- Custom Items Typescript: Type '{ id: any; name: string; representation: string; }' is not assignable to type 'CustomComboboxItem'.
    -- Custom Items: Type '{ id: number; name: string; representation: string; hex: string; }' is not assignable to type '{ id: any; name: any; representation: any; }'.
  5. Hyperlink ✅
  6. IconButton ❌
    -- Basic Usage: Property 'success' does not exist on type 'typeof ButtonColor'.
    -- Event Handling type error
  7. Toast ✅
  8. DatePicker ❌
    -- Value: Type 'string' is not assignable to type 'Date'.
    -- Minimum and Maximum Dates: Type 'string' is not assignable to type 'Date'.
    -- Clearing the Date: Argument of type 'null' is not assignable to parameter of type 'Date'.
  9. Dropdown ❌
    -- OptionalDropdownMenuItem: Type '{ children: string; toggle: true; onClick: () => void; }' is not assignable to type 'IntrinsicAttributes & { toggle: any; dropdownMenuItemProps: any; }'
  10. Form ✅
  11. FormGroup ❌
    -- Inverse: Toggle is imported and not used
  12. useFocusLock ✅

These 3 items were added to the ticket yesterday morning and have not been addressed yet:
13. ProgressBar ❌
14. RadioButton ❌
15. Select ❌

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Collaborator

@silvalaura silvalaura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Grid ✅
  2. Container ✅
  3. Stepper ✅
  4. Combobox ✅
  5. Hyperlink ✅
  6. IconButton ✅
  7. Toast ✅
  8. DatePicker ❌
    -- Minimum and Maximum Dates:
    image
  9. Dropdown ✅
  10. Form ✅
  11. FormGroup ✅
  12. useFocusLock ✅
  13. ProgressBar ✅
  14. RadioButton ❌
    image
  15. Select ❌
    I still see scrollbars
### MultiSelect
<div style={{ overflowX: 'scroll' }}>

@@ -25,7 +25,7 @@ import { LeadParagraph } from '../../components/LeadParagraph';

An accordion is made up of four components: `Accordion`, `AccordionItem`, `AccordionButton` and `AccordionPanel`. The `Accordion` is the wrapper for all of the items. It can contain one or more `AccordionItems`, each of which should contain one `AccordionButton` and one `AccordionPanel`. An `AccordionButton` can be wrapped in an element with the role of heading (such as an h1-h6) to provide semantic structure to the document.

By default, multiple items will can be expanded. The `defaultIndex` prop, which takes an array of zero-based indices, can be used to set panels open by default.
By default, multiple items are expandable. The `defaultIndex` prop which takes a of zero-based array can be used to set panels open by default.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is confusing

website/react-magma-docs/src/pages/api/radio.mdx Outdated Show resolved Hide resolved
Copy link
Contributor

Copy link
Contributor

@silvalaura
Copy link
Collaborator

silvalaura commented Nov 21, 2024

CodeSandbox error in Radio Button > Forward Ref
image

If I then manually select option 2, clicking the toggle option 1 button does not toggle back to option one. Should it?

Copy link
Contributor

Copy link
Contributor

@@ -470,20 +470,25 @@ export function Example() {
Using React's `forwardRef` feature you can gain access to the reference of the internal radio.

```tsx
import React from 'react';
import React from "react";
Copy link
Collaborator

@silvalaura silvalaura Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized this example has been broken since 2.3.9, so it took me a second to understand what it's trying to achieve. I think it's trying to showcase how you can programmatically, with a ref (radioRef), set or unset the radio button option one. I think we can achieve this and clean this example a little bit better with something like this:

import React from 'react';
import {
  RadioGroup,
  Radio,
  Button,
  ButtonColor,
  ButtonGroup,
} from 'react-magma-dom';

export function Example() {
  const radioRef = React.useRef();
  const [radioGroupVal, setRadioGroupVal] = React.useState(null);

  function handleSelectOne() {
    if (!radioRef.current || radioRef.current.checked) {
      setRadioGroupVal(null);
    } else if (!radioRef.current.checked) {
      setRadioGroupVal("1");
    }
  }

  function handleFocusOne() {
    radioRef.current.focus();
  }

  return (
    <>
      <RadioGroup
        labelText="Forward ref usage"
        id="forwardRefGroup"
        name="forwardRef"
        value={radioGroupVal}
      >
        <Radio
          ref={radioRef}
          id="forwardRefRadio1"
          labelText="Option one label"
          value="1"
        />

        <Radio id="forwardRefRadio2" labelText="Option two label" value="2" />
      </RadioGroup>

      <ButtonGroup>
        <Button onClick={handleSelectOne}>Toggle option 1 selection</Button>
        <Button color={ButtonColor.secondary} onClick={handleFocusOne}>
          Focus option 1
        </Button>
      </ButtonGroup>
    </>
  );
}

Copy link
Contributor

Copy link
Contributor

@silvalaura silvalaura merged commit 78aad09 into dev Nov 21, 2024
2 checks passed
@silvalaura silvalaura deleted the fix/docSiteIssues branch November 21, 2024 22:12
@moathabuhamad-cengage
Copy link
Collaborator

What I tested

  1. Grid ✅
  2. Container ✅
  3. Stepper ✅
  4. Combobox ✅
  5. Hyperlink ✅
  6. IconButton example error Property 'success' does not exist on type 'typeof ButtonColor'.typescript(2339)
  7. Toast ✅
  8. DatePicker ✅
  9. Dropdown ✅ error will be addressed in Dropdown > Expandable Menu Items > Icon missing at parent level #1573
  10. Form ✅
  11. FormGroup ✅
  12. useFocusLock ✅

@silvalaura
Copy link
Collaborator

What I tested

  1. Grid ✅
  2. Container ✅
  3. Stepper ✅
  4. Combobox ✅
  5. Hyperlink ✅
  6. IconButton example error Property 'success' does not exist on type 'typeof ButtonColor'.typescript(2339)
  7. Toast ✅
  8. DatePicker ✅
  9. Dropdown ✅ error will be addressed in Dropdown > Expandable Menu Items > Icon missing at parent level #1573
  10. Form ✅
  11. FormGroup ✅
  12. useFocusLock ✅

The IconButton error is only visible because our default codesandbox doesn't use the latest pre-release version. I have confirmed that if you change the package to the latest, the error disappears.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Various Docs site issues
3 participants