Skip to content

Conversation

@davydog187
Copy link
Collaborator

@davydog187 davydog187 commented Apr 28, 2021

This PR adds support to prop :values such that a range can be used to communicate the possible values.

Example

defmodule MyComponent do
  use Surface.Component
  
  prop age, :integer, values: 1..100, default: 1
  
  ...
end

Considerations

This adds is_struct/2 as a guard, which was added in Elixir 1.11. I'm not sure which version we're looking to support. If we need to support earlier versions, then I believe I'll need to refactor validate_opt/7 as the way it currently works only supports rejecting values

Follow ups

If this PR is accepted, I will also PR to update the docs and the catalogue to support this new feature

Copy link
Collaborator

@miguel-s miguel-s 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 to me!

You'll need to update the error message in the exisiting test at api_test.exs:46.

@davydog187
Copy link
Collaborator Author

@miguel-s done, and changed the minimum supported elixir version to 1.11, and updated the CI matrix to reflect.

Per slack, @msaraiva seems ok with this.

@msaraiva
Copy link
Member

msaraiva commented Apr 28, 2021

Hi @davydog187!

Thanks for the PR. Do you know if this requires any change in surface_catalogue and surface_site? Since both present the list of values in the docs, we need to make sure that not only it doesn't break anything but it also has to present them properly.

image

@davydog187
Copy link
Collaborator Author

@msaraiva yes it will! I mentioned it in the description, you may have missed it. I'll add those PRs now

@msaraiva
Copy link
Member

@davydog187 yes. I missed it. Sorry. 😁

Copy link
Collaborator

@miguel-s miguel-s left a comment

Choose a reason for hiding this comment

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

Thanks @davydog187 ❤️

@msaraiva
Copy link
Member

@davydog187 since this one sets the minimum version of Elixir to v1.11, I'll leave it out of v0.4. We can merge it before v0.5, which should not take long as we already have the new changes in the syntax approved and the work has already begun.

@davydog187
Copy link
Collaborator Author

I have a similar one coming. No worries

@davydog187
Copy link
Collaborator Author

Updated the documentation surface-ui/surface_site#33

@msaraiva
Copy link
Member

msaraiva commented May 1, 2021

Hey @davydog187!

Since we already have an "official" branch for v0.5, which is https://github.com/surface-ui/surface/tree/ms-use-custom-tokenizer, it would be nice to merge this there. Can you submit this PR against that branch instead of master? You can do the same for any follow-up PR you might have that should be applied to v0.5.0.

Cheers.

@davydog187
Copy link
Collaborator Author

You got it!

@msaraiva
Copy link
Member

msaraiva commented May 1, 2021

@davydog187 quick correction. Please use https://github.com/surface-ui/surface/tree/surface-next as the target for any PR that should be applied to v0.5. Sorry for the last-minute change. Thanks.

@davydog187
Copy link
Collaborator Author

I probably won't get to it until Monday. No worries, thanks for the update

@davydog187 davydog187 changed the base branch from master to surface-next May 2, 2021 12:33
@davydog187
Copy link
Collaborator Author

@msaraiva rebased with surface-next and set that branch as the target of this PR.

@davydog187
Copy link
Collaborator Author

Once this is merged i'll do the same with my other PR as it will have merge conflicts

@msaraiva msaraiva merged commit ffc5c7b into surface-ui:surface-next May 2, 2021
@msaraiva
Copy link
Member

msaraiva commented May 2, 2021

@davydog187 thanks! ❤️

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.

3 participants