-
Notifications
You must be signed in to change notification settings - Fork 77
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
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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! 🚀
|
||
### 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"; |
There was a problem hiding this comment.
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/");
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
import { setAssetPath } from "@esri/calcite-components/dist/components"; | |
import { setAssetPath } from "@esri/calcite-components"; |
There was a problem hiding this 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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
Summary
Calcite Components
toCalcite components