Skip to content

Add UI samples to storybook #61

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

Merged
merged 6 commits into from
Apr 3, 2023
Merged

Conversation

yoching
Copy link
Contributor

@yoching yoching commented Mar 24, 2023

I've added these UI elements to storybook:

  • Banner
  • Card
  • CopyField
  • ErrorCard
  • FoldToggle
  • KeyboardShortcut
  • Modal
  • Navigation

Copy link
Member

@hojberg hojberg left a comment

Choose a reason for hiding this comment

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

Glorious!! I add a few comments, but this is so awesome, thank you!

, C.ExternalHref "link 3" |> N.navItem "item 3"
, C.ExternalHref "link 4" |> N.navItem "item 4"
]
|> Array.fromList
Copy link
Member

Choose a reason for hiding this comment

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

What do we get from Array over List here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was to access one element by its index, but I change it to simply use List.

import Card from "./Card.elm";
import ErrorCard from "./ErrorCard.elm";
import Banner from "./Banner.elm";
import CopyField from "./CopyField.elm";
Copy link
Member

Choose a reason for hiding this comment

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

I think this one also has a webcomponent associated with it that we'd want to import in the js world.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. So are there different ways to use Elm components, other than writing like this?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah there's a few Elm modules that have a WebComponent pair to do native JavaScript stuff. In this case its src/UI/CopyOnClick.js, which need to be included in the bundle for copy to work (the other examples are OnClickOutside.js, EmbedSvg.js, EmbedMermaid.js, and EmbedKatex.js FWIW).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. I changed the code to import CopyOnClick.js

@hojberg
Copy link
Member

hojberg commented Apr 3, 2023

🎉

@hojberg hojberg merged commit bc0a8a3 into unisonweb:main Apr 3, 2023
@yoching yoching deleted the storybook-ui branch April 5, 2023 13:25
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.

2 participants