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

docs(readme): remove redundant sections, fix broken link #11530

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

Conversation

benelan
Copy link
Member

@benelan benelan commented Feb 12, 2025

Summary

  • Refer to the documentation site's get started page for all of the NPM package usage instructions.
  • Fix a broken link to the contributing documentation, which was moved to the root directory of the monorepo.
  • Change Calcite Components to Calcite components
  • Cleanup the react wrapper package's readme

@github-actions github-actions bot added the docs Issues relating to documentation updates only. label Feb 12, 2025
@calcite-admin calcite-admin added the skip visual snapshots Pull requests that do not need visual regression testing. label Feb 12, 2025
@benelan benelan requested a review from jcfranco as a code owner February 12, 2025 02:27
Copy link
Member

@geospatialem geospatialem left a comment

Choose a reason for hiding this comment

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

Few considerations for your review, but otherwise LGTM! 🚀

packages/calcite-components-react/README.md Outdated Show resolved Hide resolved

### Custom Elements build

[Custom Elements](developers.arcgis.com/calcite-design-system/get-started#custom-elements) is the recommended build when using frontend frameworks, such as React. To use this build, you will need to set the path to the `calcite-components` assets. You can either use local assets, which will be explained in a subsequent step, or assets hosted on a CDN.
[Custom Elements](developers.arcgis.com/calcite-design-system/get-started#custom-elements) is the recommended build when using frontend frameworks, such as React. To use this build, you will need to set the path to the components assets. You can either use local assets, which will be explained in a subsequent step, or assets hosted on a CDN.

```jsx
import { setAssetPath } from "@esri/calcite-components/dist/components";
Copy link
Member

Choose a reason for hiding this comment

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

Would the commented out setAssetPath need to removed, or edited to reflect more of a local/different cdn, maybe similar to our doc site example:

setAssetPath("/path-to-your-assets/");

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's fine as it is because it's where React apps commonly serve their assets, e.g. our React example:

setAssetPath(window.location.href);

It's generalized in the doc because it's not the same for all frameworks or build tools, e.g. our rollup example:

setAssetPath(document.currentScript.src);

Copy link
Member Author

@benelan benelan Feb 12, 2025

Choose a reason for hiding this comment

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

I guess we could remove the commented snippet for CDN assets though because I think Lumina uses the CDN by default when setAssetPath isn't called.

Copy link
Member Author

Choose a reason for hiding this comment

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

@maxpatiiuk is that correct? And is there a new default behavior for defineCustomElements?

Copy link
Member

Choose a reason for hiding this comment

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

I guess we could remove the commented snippet for CDN assets though because I think Lumina uses the CDN by default when setAssetPath isn't called.

Correct. in map-components 4.32 we only document setAssetPath for people who don't want to use our CDN/need offline deployment

Copy link
Member

Choose a reason for hiding this comment

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

Yes, defineCustomElements has the same behaviour
Also, if resourceUrl is provided to defineCustomElements, it simply calls setAssetPath for you - equivalent to calling setAssetPath directly.

Copy link
Member

Choose a reason for hiding this comment

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

The path can be simplified:

Suggested change
import { setAssetPath } from "@esri/calcite-components/dist/components";
import { setAssetPath } from "@esri/calcite-components";

@geospatialem geospatialem added this to the 3.0.0 Patch - 2025-02-13 milestone Feb 12, 2025
Copy link
Contributor

@DitwanP DitwanP left a comment

Choose a reason for hiding this comment

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

// defineCustomElements(window, {
// resourcesUrl: "https://unpkg.com/@esri/calcite-components/dist/calcite/assets"
// });
defineCustomElements(window);
Copy link
Member

Choose a reason for hiding this comment

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

don't need to pass window - it is ignored if passed

Copy link
Member

Choose a reason for hiding this comment

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

With Lumina, you are now also providing JSX typings for React 19 users.
Given that more and more people will be shifting to React 19, it would be ideal to point out on this page or somewhere else that wrappers are not required in React 19 (but still supported).

documentation on usage in React in https://qawebgis.esri.com/components/lumina/publishing#using-the-npm-package (generally same as other frameworks, except for need to add a specific /// directive to get the JSX typings)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Issues relating to documentation updates only. skip visual snapshots Pull requests that do not need visual regression testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants