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

feat: add DiscountApplicationStrategyCard #154

Merged
merged 10 commits into from
Sep 21, 2023

Conversation

mathiusj
Copy link
Contributor

@mathiusj mathiusj commented Sep 18, 2023

What problem is this PR solving?

closes: https://github.com/Shopify/core-issues/issues/60529

Reviewers’ hat-rack 🎩

  • yarn storybook
  • review story for DiscountAppStrategyCard
image

Before requesting reviews

Before you deploy

Warning
With every PR, you MUST think through each of the items in the following checklist and check the appropriate ones. This step cannot be overlooked by the PR author or its reviewers. Please remove this warning when you're done.

  • This PR is safe to rollback.
  • I tophatted this change on Storybook.

@github-actions
Copy link
Contributor

Hello and thank you for your contribution! Before we can merge your pull request, we ask that you create a changeset to describe your changes. This will help us manage versions and release notes. You can create a changeset by running yarn changeset in your terminal. You can find more information about our contribution guidelines here. Thank you again!

@mathiusj mathiusj force-pushed the mathiusj/add-application-strategy-card branch 4 times, most recently from 327a8d2 to e76c803 Compare September 19, 2023 19:35
@mathiusj mathiusj changed the title feat: add DiscountApplicationStrategyCard (wip) feat: add DiscountApplicationStrategyCard Sep 19, 2023
@mathiusj mathiusj force-pushed the mathiusj/add-application-strategy-card branch from e76c803 to 01994a4 Compare September 19, 2023 19:36
@mathiusj mathiusj marked this pull request as ready for review September 19, 2023 19:36
@translation-platform
Copy link
Contributor

translation-platform bot commented Sep 21, 2023

We have received a translation request but there is a question blocking translation work. Your help is needed.

Please answer the following questions.

Warning
Replies in GitHub are not visible to translators. Use the provided "Answer here" links. 🙅‍♀️


Note
Not your issue? Forward it to someone with more context; please don't leave it pending. 🙏
Questions? Hop in the #help-localization Slack channel.

Copy link
Contributor

@devisscher devisscher left a comment

Choose a reason for hiding this comment

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

Looks good!

I'm reluctant to call it DiscountAppStrategyCard, it might be worth calling it DiscountApplicationStrategyCard even though it's longer :/ let me know how you feel about that. It would be more inline with the name of the api field and avoids confusion.


expect(methodCard).not.toContainReactComponent(TextField, {
label: 'Title',
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a test that ensures the onChange function is called with the value of the choice selected?


## Usage and best practices

- The discount code length only adjusts the default length of generated codes, and does not set a max length for the text input
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this part of the readme is related to this card?

'@shopify/discount-app-components': minor
---

Add DiscountAppStrategyCard
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd add what it does here:

Add DiscountApplicationStrategyCard, which allows the user to select the discount application strategy, maximum or first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the comments, have updated each of them in the latest commits 🙏

@mathiusj mathiusj force-pushed the mathiusj/add-application-strategy-card branch from 12201a7 to ee26d4a Compare September 21, 2023 17:53
Copy link
Contributor

@devisscher devisscher left a comment

Choose a reason for hiding this comment

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

Looks good! Added a couple more comments. 😄

### Basic usage

```jsx
<DiscountAppStategyCard strategy="All" />
Copy link
Contributor

Choose a reason for hiding this comment

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

src/types.ts Outdated

export enum DiscountApplicationStrategy {
First = 'First',
Maximum = 'Maximum',
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice catch! updated

},
]}
selected={[strategy.value]}
onChange={handleChange}
Copy link
Contributor

Choose a reason for hiding this comment

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

One last thing sorry :D should the value be represented by the ENUM here? Instead of a translated string?

Copy link
Contributor Author

@mathiusj mathiusj Sep 21, 2023

Choose a reason for hiding this comment

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

if you're referring specifically to the selected value, then I think it would be fine so long as the pattern in MethodCard is accurately representing the pattern we should value.

However, I do see that the choices' values can and should be updated to the enum!?

screenshot for reference:
image

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I was referring to the value prop in the choices :) I guess my comment was at the wrong spot!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated!

Copy link
Contributor

@devisscher devisscher left a comment

Choose a reason for hiding this comment

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

🙌

@mathiusj mathiusj merged commit cb5c895 into main Sep 21, 2023
5 checks passed
@mathiusj mathiusj deleted the mathiusj/add-application-strategy-card branch September 21, 2023 19:59
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