-
Notifications
You must be signed in to change notification settings - Fork 7
Various documentation improvements #385
Conversation
🦋 Changeset detectedLatest commit: 30cdced The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
0f4c328
to
19deecb
Compare
'@crowdstrike/glide-core': minor | ||
--- | ||
|
||
Menu no longer offers a `focus()` method, which focused its target. Simply call `focus()` on your target 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.
No need for a middleman, I figured.
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.
Have we checked consumers to see if they're using this?
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 haven't because it wouldn't affect the outcome for me. Whether they're using it or not, it's superfluous for Menu to offer a method already offered by their target button.
If it were in use, would that change the calculus for you?
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.
Sorry, I should have said more: I'm cool with this change either way, we'd just need to be sure to communicate that this is a possible breaking change when it comes time to release. But we're good about doing that anyway, so I probably don't need to say it :)
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.
Haha. Got it. Yeah, that's implied (though not obvious) by minor
for us. But, yeah, I trust that @ynotdraw will spread the good word.
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.
🫡 you bet!
|
||
export default meta; | ||
|
||
export const Tabs: StoryObj = { |
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.
Do we need an overflow story? Or can we just show overflow in the primary story?
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'd vote for a separate overflow story. Because it seems to me the most common case is no overflow.
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 can dig it. I'll revert this.
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.
✅ 30cdced
2aa29ab
to
44d7c85
Compare
70989a5
to
a7b75b9
Compare
'slot="tooltip"': { | ||
control: { type: 'text' }, | ||
table: { | ||
type: { summary: 'HTMLKBDElement | string' }, |
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.
Slotting a string into a named slot is actually impossible. Derp.
My first thought was to change this to HTMLKBDElement | Element
. But Element
includes HTMLKBDElement
. So I went with Element
and thought I'd let the control, which is prominent and easy to read, speak for the <kbd>
part.
Similar thinking for the 'slot="description"'
changes above and throughout.
a7b75b9
to
f57b44e
Compare
import '@crowdstrike/glide-core/button-group.js'; | ||
import '@crowdstrike/glide-core/button-group.button.js'; | ||
</script> | ||
render(arguments_) { |
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.
render: () => {}
→ render() {}
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.
Probably lintable, eh?
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.
Almost certainly. There's a lot I'd like us to lint in stories. The order of top-level is meta
properties is another.
Let me get our lint rule guy on the horn 😆. CC: @ynotdraw.
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.
☎️ you rang!?!??!
(I'll add this to my list)
8399d85
to
6cad939
Compare
<glide-core-button-group-button label="Two"> | ||
<glide-core-example-icon | ||
slot="prefix" | ||
name="pencil" |
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.
}, | ||
type: { name: 'string', required: true }, | ||
}, | ||
open: { |
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.
Most other argTypes
changes below and throughout are just from reordering to match the order of args
.
6cad939
to
a6572a6
Compare
<glide-core-menu-link label="Three" url="/"></glide-core-menu-link> | ||
</glide-core-split-button-container> | ||
`, | ||
<glide-core-menu-button label="One"></glide-core-menu-button> |
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.
Two buttons and one link, same as Split Button Container. Most users will probably click the first or second option, which means they won't be suddenly navigated like they would with a link. But a link is still available if they want to click it.
290d01a
to
cb8d785
Compare
cb8d785
to
dc39940
Compare
A story showing the use of an optional slot that requires specific markup is one example. | ||
A story showing an error state triggered by a form submission is another. | ||
|
||
### Only set required attributes in stories |
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.
One more of these and we might think about putting Storybook best practices into their own section.
### Only set required attributes in stories | ||
|
||
While it's useful to present components in their full form, we think there's more value in providing minimal code examples so consumers don't copy more code than they need. | ||
Only giving required attributes a value also gives us a simple rule to follow when writing stories. |
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 wanted an example to accompany this but couldn't come up with a clear and simple one.
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.
🎉 all around
height="16" | ||
stroke="currentColor" | ||
fill="none" | ||
stroke-linecap="round" |
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.
nit: Can we ditch any of attributes that aren't necessary?
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.
This is copy pasta from another Icon Button test. But 100% we can. Is this the only one that's unnecessary?
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'm guessing you could probably remove most of them :). I say if the test passes, it passes 🤷
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.
Ah. I see where you're coming from. I was thinking you still wanted the icon to be presentable.
Strictly speaking, it doesn't even need to be an icon. Other components just throw a <div> Icon </div>
in there and call it a day.
Icon Button's tests need to be cleaned up in other ways. So I can take both the cleanup and this as a followup if want to go the <div>
route.
|
||
export default meta; | ||
|
||
export const Tabs: StoryObj = { |
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'd vote for a separate overflow story. Because it seems to me the most common case is no overflow.
b15b618
to
30cdced
Compare
🚀 Description
Added
click()
andfocus()
controls to stories. For context: Rework Split Button #361 (comment).Reordered
argTypes
to match the order ofargs
.Emptied the
slot="description"
argument in form control stories after some discussion. SeeCONTRIBUTING.md
.Add missing controls to Tab's story and renamed the story to Tab Group.
Removed unnecessary instances of
control: { type: 'boolean' }
andcontrol: { type: 'text' }
, both of which are inferred by Storybook.Replaced
render: () => {}
withrender() {}
for consistency.Modified various stories whose controls accept markup to use
unsafeHTML
. This lets Storybook users test out their markup.Allowing arbitrary markup is safe because Storybook doesn't push those controls with the URL. And, even if it did, we're not setting cookies or otherwise storing sensitive data vulnerable to an XSS.
Added a
focus()
method to Accordion and aclick()
method to Icon Button.Removed story and component descriptions.
Wasn't sure about this. Talked to @ynotdraw about it offline. Many of our descriptions are superfluous (Menu's "A basic menu") and the rest are either implied or include information already present in the controls table.
Swapped out styles in stories for top-level
decorators
property where possible.Added a Mutation Observer to Dropdown's story to account for Dropdown closing when it loses focus or something outside of it is clicked.
📋 Checklist
🔬 How to Test
focus()
method.📸 Images/Videos of Functionality
N/A