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

Proposal: Introduce react-fluentui-examples project #189

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

george-cz
Copy link
Contributor

@george-cz george-cz commented Jun 28, 2024

Motivation

Historically, in the effort of supporting our partners, we've built a lot of examples in Stackblitz displaying how to use our components in a particular use case. These use cases don't usually (ever?) make it back to the original docsite, even though others could potentially benefit from them too. The reasons for this are multiple:

  • these examples are not generic enough
  • these examples don't demonstrate the component's props/API directly, but build on top of the component to get a closer idea how to productionalize the component
  • these examples may combine multiple components
  • the doc examples have to be carefully curated, straightforward and to the point of what part of the API are they demonstrating

The problem with the current approach is that these carefully crafted examples end in up /dev/null eventually because we forget about them, or don't know about their existence in the first place. Having one place where we could store these, link to them and let the user quickly run them and play with them would be benefitial.

Other attempts

The Fluent UI v0 already has a concept of this, they call it Prototypes. This means that the idea behind this concept has been validated in the past, has proven useful and we should strive to provide a similar solution for our V9 docs.

How this works

The main ideas behind this PR are:

  • We have a place where we can store these more complex examples
  • Github repo is easy to share and Stackblitz has support to load code directly from here (Stackblitz provides a nice button!)

Visit the project here

Other considerations

  • We might want to consider tighter integration with the official doc site in the future
  • Would be nice to have a script that bootstraps the example (something I can work on if this gains some traction)
  • Granularity level for the examples: should the react-fluentui-examples be just one package and examples just storybook? Storybook has limitations, the current approach (each example is its own package) is similar to maintain, use in Stackblitz and provides more flexibility though.

Footnote

Before this gets merged, all of the links should be updated to target the main branch. Right now for the sake of validating the PR and the usage, it points to this PR branch.

@ling1726
Copy link
Member

ling1726 commented Jul 1, 2024

I think we should consider a way to get these examples served by the official docsite. It would be good to have a single source of truth here. One of the big issues with v0 prototypes was that they were not discoverable

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<FluentProvider theme={webLightTheme}>
<Example />
Copy link
Member

@ling1726 ling1726 Jul 1, 2024

Choose a reason for hiding this comment

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

Let's add some kind of mounting/routing support - Otherwise there's too much barrier for someone to contribute the 2nd,3rd

# yarn lockfile v1


"@babel/runtime@^7.1.2", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.7":
Copy link
Member

Choose a reason for hiding this comment

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

individual packages in contrib should not have a lockfile and all deps should be in the root lockfile

@@ -0,0 +1,29 @@
{
"name": "react-fluentui-examples-list-active-element",
Copy link
Member

Choose a reason for hiding this comment

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

There's no build infra in the contrib repro to handle application type projects, as all the infra is built around publishable packages. The task runner (NX) isn't even integrated to this package and it maintains its own dependencies.

I'd suggest to move it out to another /apps folder on the root to keep the separation from the publishable packages

onAction={onAction}
data-value={name}
aria-label={name}
onFocus={onFocus}

Choose a reason for hiding this comment

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

please test this with JAWS browser mode as that doesn't send focus events as you navigate.
Also, try with at least windows touch screen device if you are still able to change the value with just tap

value={name}
className={mergeClasses(
classes.item,
activeItem === name && classes.itemActive

Choose a reason for hiding this comment

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

should there also be aria-selected or some other aria prop indicating the selection state?

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.

3 participants