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

KCard: Add prop validators for 'layout' and 'thumbnailDisplay' #695

Closed
MisRob opened this issue Jul 26, 2024 · 1 comment
Closed

KCard: Add prop validators for 'layout' and 'thumbnailDisplay' #695

MisRob opened this issue Jul 26, 2024 · 1 comment
Assignees
Labels
category: library Shared code library Component: KCard P3 - low Priority: Stretch goal

Comments

@MisRob
Copy link
Member

MisRob commented Jul 26, 2024

Summary

This is one of the follow-ups to #625

  1. Use constants for all allowed layout and thumbnailDisplay prop values
  2. Add custom prop validators for these two props so that KCard throws an error when an invalid value is passed.

Guidance

You can see an example in KImg:

const ScaleTypes = {
CENTER_INSIDE: 'centerInside',
CONTAIN: 'contain',
FIT_XY: 'fitXY',
};

const ScaleTypes = {
CENTER_INSIDE: 'centerInside',
CONTAIN: 'contain',
FIT_XY: 'fitXY',
};

/**
* Specifies how an image should be scaled within the container.
* Can be one of `'centerInside'`, `'contain'`, or `'fitXY'`.
*/
scaleType: {
type: String,
default: 'centerInside', // needs to be duplicated rather than using ScaleTypes.CENTER_INSIDE, otherwise it doesn't render correctly in the auto-generated Props documentation
validator: isValidScaleType,
},

@MisRob MisRob added category: library Shared code library Component: KCard P3 - low Priority: Stretch goal labels Jul 26, 2024
@AllanOXDi AllanOXDi mentioned this issue Aug 1, 2024
9 tasks
@AllanOXDi
Copy link
Member

completed in #707

@MisRob MisRob added this to the KCard 2.0 and KCardGrid milestone Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: library Shared code library Component: KCard P3 - low Priority: Stretch goal
Projects
None yet
Development

No branches or pull requests

2 participants