Skip to content

Conversation

@pst67662
Copy link
Contributor

Closes

✅ Pull Request Checklist:

  • Included link to corresponding 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 exist for this component).
  • Looked at the Accessibility Standard and/or talked to @mijordan about Accessibility for this feature.

📝 Test Instructions:

🧢 Your Team:

@github-actions
Copy link

Build successful! View the storybook

@github-actions
Copy link

Build successful! View the storybook

@github-actions
Copy link

Build successful! View the storybook

@github-actions
Copy link

Build successful! View the storybook

@pst67662 pst67662 changed the title [WIP]RSP-1127: ProgressCircle [WIP]RSP-1127|RSP-1128: ProgressCircle and ProgressBar Oct 1, 2019
@github-actions
Copy link

github-actions bot commented Oct 1, 2019

Build successful! View the storybook

@github-actions
Copy link

github-actions bot commented Oct 1, 2019

Build successful! View the storybook

@pst67662 pst67662 changed the title [WIP]RSP-1127|RSP-1128: ProgressCircle and ProgressBar RSP-1127|RSP-1128: ProgressCircle and ProgressBar Oct 1, 2019
}
}

.spectrum-CircleLoader.react-spectrum-Wait--centered {
Copy link
Member

Choose a reason for hiding this comment

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

I don't know if we want to support this type of centering anymore? @dannify ?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we do (any reason we don't @snowystinger?). But I'm not sure if spectrum-css wants that feature. Last time they didn't, so we just put it in RSP. We could probably leave this css in RSP if that remains the case. cc. @lazd @GarthDB

Copy link
Member

Choose a reason for hiding this comment

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

hmm... i don't know where my previous response went, but i'll re-write it best as i can remember

I'm thinking this kind of centering is less needed now thanks to flex box. It also causes problems because people forget that an absolute positioned item is removed from document flow, so the parent could easily end up with height 0. It can also end up on top of other elements because it's not in the document flow.

@github-actions
Copy link

github-actions bot commented Oct 7, 2019

Build successful! View the storybook

@github-actions
Copy link

github-actions bot commented Oct 7, 2019

Build successful! View the storybook

@github-actions
Copy link

github-actions bot commented Oct 7, 2019

Build successful! View the storybook


it.each`
Name | Component
${'ProgressCircle'} | ${ProgressCircle}
Copy link
Member

Choose a reason for hiding this comment

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

do none of the rest of these tests share any common ground with V2?

}
ref={ref}
{...ariaProps}
{...filterDOMProps(otherProps)}>
Copy link
Member

Choose a reason for hiding this comment

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

put filterDOMProps first in the element, that way you don't risk it overriding any of the props you've set
then do the spread of aria
then do any you're explicitly setting

let ariaValue = ariaProps['aria-valuenow'];
if (ariaValue > 0 && ariaValue <= 50) {
angle = -180 + (ariaValue / 50 * 180);
subMask1Style.transform = 'rotate(' + angle + 'deg)';
Copy link
Member

Choose a reason for hiding this comment

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

we prefer string literals when possible

`rotate(${angle}deg)`

ref={ref}
dir={direction}
{...ariaProps}
{...filterDOMProps(otherProps)}>
Copy link
Member

Choose a reason for hiding this comment

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

change order of spreads to match guidelines written in other comment


return {
ariaProps: {
id: labelledComponentAriaProps.id,
Copy link
Member

Choose a reason for hiding this comment

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

can we just spread labelledComponentAriaProps into this object?

},
labelAriaProps,
formattedValueLabel,
percentage
Copy link
Member

Choose a reason for hiding this comment

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

percentage isn't an attribute, please put it into an appropriate object
nor is formattedValueLabel

@@ -0,0 +1,3 @@
export function clamp(value: number, min: number = -Infinity, max: number = Infinity): number {
return Math.min(Math.max(+value, min), max);
Copy link
Member

Choose a reason for hiding this comment

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

if value is a number, then we don't need to coerce it here, lets do that before we call clamp

)
}
ref={ref}
dir={direction}
Copy link
Member

Choose a reason for hiding this comment

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

this should already be set on some much higher up element, why are we setting it here?

@github-actions
Copy link

Build successful! View the storybook

expect(progressCircle).toHaveAttribute('aria-valuemax', '100');
});

it('handles submask defaults', () => {
Copy link
Member

Choose a reason for hiding this comment

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

do these tests not share the same qualities in v2?

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'll change tests to do checks on both components

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@snowystinger I need some help with this one... these tests should cover the same style transform property from V2 https://github.com/adobe/react-spectrum/blob/master/test/Wait/Wait.js#L47
except in V2 child nodes are fetched by class names... is there other way to get child nodes in V3 except adding "test-dataid" property, so I can test it on both components?

Copy link
Member

Choose a reason for hiding this comment

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

o, hmmm... that is unfortunate, we actually can't do dataid tests for v2 either, they'll get stripped out in the build
I think we'll just have to leave v2 out of this one
thanks for looking into it

Copy link
Member

Choose a reason for hiding this comment

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

add a comment to the file with that info though so we don't try to come along and add it later

@github-actions
Copy link

Build successful! View the storybook

@github-actions
Copy link

Build successful! View the storybook

Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

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

Couple other things I notice in a rereview.

@@ -0,0 +1,6 @@
.spectrum-CircleLoader.react-spectrum-ProgressCircle--centered {
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 you'll have to get rid of the .spectrum-CircleLoader part if you want this css to be applied to the ProgressCircle component correctly

} = props;

value = clamp(value, min, max);
let percentage = value / (max - min);
Copy link
Member

Choose a reason for hiding this comment

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

Hrm, I should've caught this earlier and maybe I'm wrong but I think the percentage calculation should actually be as follows: (value - min) / (max - min). The current calculation fails on min value that aren't 0.

e.g.

min = -5
max = 5
value = 0
old percentage calc = 0 / (5 - (-5)) = 0/10 = 0%
actual percentage calc = (0 - (-5))/(5 - (-5)) = (5)/(10) = .5 = 50% 

Might be worthwhile writing a test to cover this case since this looks like it was broken in v2 as well.

@github-actions
Copy link

Build successful! View the storybook

Copy link
Member

@devongovett devongovett left a comment

Choose a reason for hiding this comment

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

Looks great! 🎉

One small name change. Also merged in master and got a few failures due to the new package linting. You'll need to update dependencies to point to the alpha versions we published, and fix those lint errors.

@devongovett
Copy link
Member

image

also noticed that the centered story is not centered 😆

@github-actions
Copy link

Build successful! View the storybook

@github-actions
Copy link

Build successful! View the storybook

@pst67662
Copy link
Contributor Author

@devongovett centered story fixed

@devongovett devongovett merged commit 3df08a7 into master Oct 17, 2019
@devongovett devongovett deleted the RSP-1127 branch October 17, 2019 15:33
@github-actions
Copy link

Build successful! View the storybook

devongovett pushed a commit that referenced this pull request Jul 25, 2024
* TagGroup
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.

5 participants