Blocked by
Summary
Implement KCard, an accessible base card component offering the most frequently used card content and thumbnail layouts, as well as other customization options. Please see #528 first, and also note that KCard is built on top of the BaseCard #529.
Markup requirements
- Passes all its content via the default slot down to
BaseCard
KCard.vue
<BaseCard>
...
</BaseCard>
Style requirements
- Doesn't have any styles affecting its placement within its parent component (e.g. outer margins)
- Has temporarily set width/height (so that we can preview it in a reasonable manner, but this will be worked on later as part of the card grid component)
- Implements spaces between slots and thumbnail area
- Doesn't assume slots content (e.g. slots have no fixed height)
- Robust content tolerance (very short/very long title, with or without thumbnail, ...)
- Follows Figma designs as closely as possible
Architecture requirements
- Is built on top of
BaseCard
- Uses
KImg for the thumbnail area implementation
- sets
isDecorative to true on KImg (the thumbnail image is decorative)
KCard's thumbnailScaleType is passed down to KImg's scaleType
- Uses
KTextTruncator for title truncation
Interface
Props
| Name |
Description |
Type |
Required |
Default |
to |
Router-link object that enables user navigation to the intended route. |
Object |
true |
- |
title |
Sets the value of the title text. A simpler alternative to the title slot. |
String |
false |
null |
titleLines |
A number of lines a title text is truncated to. |
Number |
false |
2 |
headingLevel |
A level of the heading element (<h2>-<h6>) wrapping a title text. Supported values: 2-6. |
Number |
true |
- |
layout |
Determines the visual layout of card's content. Can be one of: 'horizontal', 'vertical'. |
String |
false |
'horizontal' |
thumbnailDisplay |
Determines whether a thumbnail area is displayed or not, and sets its size. Can be one of: 'none', 'small', 'large'. When it's 'small' or 'large' and thumbnailSrc is empty or invalid, the thumbnail area will be filled with thumbnailBackgroundColor acting as a placeholder. |
String |
false |
'none' |
thumbnailSrc |
Source URL of a thumbnail image |
String |
false |
null |
thumbnailScaleType |
Specifies how an image should be scaled within the thumbnail area. Can be one of 'centerInside', 'contain', or 'fitXY'. See KImg's scaleType. |
String |
false |
'centerInside' |
Slots
| Name |
Description |
title |
Optional slot section containing the title contents, should not contain a heading element. An alternative to the title prop. |
aboveTitle |
Places content above the title area. |
belowTitle |
Places content below the title area. |
footer |
Places content to the footer area. |
thumbnailPlaceholder |
When a thumbnail placeholder area is displayed (for example when the image is not available or can't be loaded), you can use this slot to place content to the area. |
Events
| Name |
Description |
focus |
Emitted when the card element has received focus. |
hover |
Emitted when the mouse pointer enters or leaves the card element |
Acceptance criteria
Blocked by
Summary
Implement
KCard, an accessible base card component offering the most frequently used card content and thumbnail layouts, as well as other customization options. Please see #528 first, and also note thatKCardis built on top of theBaseCard#529.Markup requirements
BaseCardKCard.vue
Style requirements
Architecture requirements
BaseCardKImgfor the thumbnail area implementationisDecorativetotrueonKImg(the thumbnail image is decorative)KCard'sthumbnailScaleTypeis passed down toKImg'sscaleTypeKTextTruncatorfor title truncationInterface
Props
toObjecttruetitletitleslot.StringfalsenulltitleLinesNumberfalse2headingLevel<h2>-<h6>) wrapping a title text. Supported values:2-6.Numberlayout'horizontal','vertical'.Stringfalse'horizontal'thumbnailDisplay'none','small','large'. When it's'small'or'large'andthumbnailSrcis empty or invalid, the thumbnail area will be filled withthumbnailBackgroundColoracting as a placeholder.Stringfalse'none'thumbnailSrcStringfalsenullthumbnailScaleType'centerInside','contain', or'fitXY'. SeeKImg'sscaleType.Stringfalse'centerInside'Slots
titletitleprop.aboveTitlebelowTitlefooterthumbnailPlaceholderEvents
focushoverAcceptance criteria
thumbnailScaleTypeprop value is a valid scale type (see the same validator inKImg)KCardheadingLevelto notify developers that they need to choose a correct level based on contexttitleto aid users in searching through lists of links