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

Adding ListView chromatic stories #3106

Merged
merged 12 commits into from
May 11, 2022
Merged

Adding ListView chromatic stories #3106

merged 12 commits into from
May 11, 2022

Conversation

LFDanLu
Copy link
Member

@LFDanLu LFDanLu commented May 5, 2022

Closes

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Look at the chromatic tests for ListView and confirm behavior

🧢 Your Project:

RSP

@adobe-bot
Copy link

Build successful! 🎉

Comment on lines 74 to 78
/**
* A slot to place the ActionGroup in.
* @default 'actionGroup'
*/
slot?: string
Copy link
Member Author

Choose a reason for hiding this comment

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

Not entirely sure if this slot prop should be exposed, it all depends on our slot naming consistency and whether or not a ActionGroup could be placed in a slot other than actionGroup. I fine with removing this for now and adding it back in when we have a need

Same applies for ActionMenu below

Copy link
Member

Choose a reason for hiding this comment

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

makes sense, it should be here

Copy link
Member

Choose a reason for hiding this comment

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

Where is this slot being used by ListView?

Copy link
Member Author

Choose a reason for hiding this comment

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

This slot is used here:

actionGroup: {
UNSAFE_className: listStyles['react-spectrum-ListViewItem-actions'],
isQuiet: true,
density: 'compact'
},

Copy link
Member

@devongovett devongovett May 11, 2022

Choose a reason for hiding this comment

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

hmmmmm.... we don't havre this on any other component (other than ones designed for this, e.g. Text)? Are we sure this is needed? When would you set the slot to something other than the default? Also doesn't appear to be used by this PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, currently the default slot provided to ActionMenu/ActionGroup suffices for now, definitely isn't needed but was prompted by the ListView stories:

<ActionGroup buttonLabelBehavior="hide" {...props} slot="actionGroup">
<Item key="info">
<Info />
<Text>Info</Text>
</Item>
</ActionGroup>
<ActionMenu {...props} slot="actionMenu">
. I'll remove it for now.

@@ -24,7 +24,7 @@ import {useMessageFormatter} from '@react-aria/i18n';
import {useSlotProps} from '@react-spectrum/utils';

function ActionMenu<T extends object>(props: SpectrumActionMenuProps<T>, ref: FocusableRef<HTMLButtonElement>) {
props = useSlotProps(props, 'actionmenu');
props = useSlotProps(props, 'actionMenu');
Copy link
Member Author

@LFDanLu LFDanLu May 5, 2022

Choose a reason for hiding this comment

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

Brings it in line with the slot naming convention set up by ActionGroup, ButtonGroup etc. None of our other components used this slot except for ListView so we should be fine changing it here

Copy link
Member

Choose a reason for hiding this comment

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

fyi, this was the only reference i found in quarry for the 'actionmenu' slot https://git.corp.adobe.com/frontend/quarry/blob/9aa61397fad5f2b919d90bc67bad3c0fa5f3efbd/packages/%40quarry/inventory/src/views/list/ListViewItem.tsx#L103
you may want to double check me on that and make sure this is still safe

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, I don't believe this change will affect them, if anything that should already be broken if they are relying on getting our ListViewItem class from the actionMenu slot: https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/list/src/ListViewItem.tsx#L224

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh never mind, that is a actionmenu grid area not a slot so the above change doesn't affect it at all. The actionmenu matches up with the ListView css grid area:

"draghandle checkbox icon image content actions actionmenu chevron"
"draghandle checkbox icon image description actions actionmenu chevron"

reidbarber
reidbarber previously approved these changes May 6, 2022
Copy link
Member

@reidbarber reidbarber left a comment

Choose a reason for hiding this comment

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

LGTM

@ktabors
Copy link
Member

ktabors commented May 6, 2022

Do we have a chromatic build of these stories to look at?

@reidbarber
Copy link
Member

reidbarber commented May 6, 2022


const meta: Meta = {
title: 'ListView',
component: ListView,
parameters: {
chromaticProvider: {colorSchemes: ['light', 'dark'], locales: ['en-US'], scales: ['medium', 'large'], disableAnimations: true},
Copy link
Member

Choose a reason for hiding this comment

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

did it just extend too far to do lightest and darkest?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, would mean more story splitting for performance. I'm beginning to think that perhaps we should have a separate story per combo, might be a lot though

Copy link
Member Author

Choose a reason for hiding this comment

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

Looking at storybookjs/storybook#9828, doesn't seem to be a great way to do this w/o going back to the storiesOf api. I'm leaning towards keeping this PR as is since we are looking to upgrade our storybook version and waiting for overflowMode to go in so we can get a relatively stable set of combinations per story (otherwise any changes to the power set will result in a difficult to comprehend diff).


export default meta;

export {
Copy link
Member

Choose a reason for hiding this comment

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

nice, love this

Comment on lines 74 to 78
/**
* A slot to place the ActionGroup in.
* @default 'actionGroup'
*/
slot?: string
Copy link
Member

Choose a reason for hiding this comment

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

makes sense, it should be here

ktabors
ktabors previously approved these changes May 6, 2022
Copy link
Member

@ktabors ktabors left a comment

Choose a reason for hiding this comment

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

LGTM

{name: 'row 1'},
{name: 'row 2'},
{name: 'row 3'}
// TODO: add overflow mode and thumbnails when those PRs are merged
Copy link
Member

Choose a reason for hiding this comment

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

should this be documented in github as an issue or project task instead of a todo?

Copy link
Member Author

@LFDanLu LFDanLu May 9, 2022

Choose a reason for hiding this comment

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

sure, will add if this goes in before those PRs

// TODO: add overflow mode and thumbnails when those PRs are merged
let states = [
{isQuiet: true},
// No visual difference between single and multiple
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we have a story with selectedKeys and then we'd need multiple selection to see how that looks?

Copy link
Member Author

Choose a reason for hiding this comment

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

The story already has selectedKeys with multiple selected, though this should probably be {selectionMode: 'multiple'}, rather than 'single. Unlike TableView where singleandmultiple` will either hide/display the select all checkbox, ListView doesn't have this distinction and thus we don't need to have both selection modes in the power set

Comment on lines 74 to 78
/**
* A slot to place the ActionGroup in.
* @default 'actionGroup'
*/
slot?: string
Copy link
Member

Choose a reason for hiding this comment

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

Where is this slot being used by ListView?

@LFDanLu LFDanLu dismissed stale reviews from ktabors and reidbarber via 8de08d6 May 9, 2022 23:13
@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@LFDanLu
Copy link
Member Author

LFDanLu commented May 10, 2022

latest Chromatic build: https://www.chromatic.com/build?appId=5f0dd5ad2b5fc10022a2e320&number=261
Attempted to reorg into the following structure to support Darkest + Lightest:

export const DarkestMedium = Template().bind({});
DarkestMedium.storyName = 'all visual options, darkest, medium';
DarkestMedium.args = {combos: combinations};
DarkestMedium.parameters = {
  chromaticProvider: {
    ...defaultParams.chromaticProvider,
    colorSchemes: ['darkest'],
    scales: ['medium']
  }
};

export const DarkestLarge = Template().bind({});
DarkestLarge.storyName = 'all visual options, darkest, large';
DarkestLarge.args = {combos: combinations};
DarkestLarge.parameters = {
  chromaticProvider: {
    ...defaultParams.chromaticProvider,
    colorSchemes: ['darkest'],
    scales: ['large']
  }
};

but that was problematic w/ RTL support. Will need to refactor with changes to https://github.com/adobe/react-spectrum/blob/main/.chromatic/custom-addons/chromatic/index.js to properly support RTL + certain theme and size combos which may change a bunch of stories so will be followup

snowystinger
snowystinger previously approved these changes May 10, 2022
@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@adobe-bot
Copy link

Build successful! 🎉

@LFDanLu LFDanLu merged commit 628791e into main May 11, 2022
@LFDanLu LFDanLu deleted the listview_chromatic branch May 11, 2022 16:45
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.

7 participants