@reykjavik/hanna-react 0.10.98 → 0.10.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,12 +4,14 @@
4
4
 
5
5
  - ... <!-- Add new lines here. -->
6
6
 
7
- ## 0.10.98
7
+ ## 0.10.97 – 0.10.99
8
8
 
9
9
  _2023-08-22_
10
10
 
11
- - feat: Allow `JSX.Element` as item `summary` for all `*Cards` components
11
+ - feat: Add prop `meta` to items of `ActionCards`
12
12
  - feat: Add prop `summary` to items of `ArticleCards` and `ImageCards`
13
+ - feat: Allow `JSX.Element` as item `meta` for accepting `*Cards` components
14
+ - feat: Allow `JSX.Element` as item `summary` for all `*Cards` components
13
15
  - feat: Expand `MainMenuItemList` to allow components as custom
14
16
  `MainMenu__item` children
15
17
  - feat: Add default Polish translation for `Layout`
package/ExtraLinks.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { TextCardListProps } from './_abstract/_CardList.js';
1
+ import { CardListProps, TextCardProps } from './_abstract/_CardList.js';
2
2
  import { SeenProp } from './utils/seenEffect.js';
3
3
  export type RelatedLink = {
4
4
  href: string;
@@ -10,8 +10,8 @@ type RelatedProps = {
10
10
  relatedTitle?: string;
11
11
  relatedLinks?: Array<RelatedLink>;
12
12
  };
13
- export type ExtraLinksCardProps = TextCardListProps['cards'][number];
14
- export type ExtraLinksProps = TextCardListProps & RelatedProps & {
13
+ export type ExtraLinksCardProps = Omit<TextCardProps, 'meta'>;
14
+ export type ExtraLinksProps = CardListProps<ExtraLinksCardProps> & RelatedProps & {
15
15
  className?: string;
16
16
  } & SeenProp;
17
17
  export declare const ExtraLinks: (props: ExtraLinksProps) => JSX.Element;
@@ -4,11 +4,11 @@ import { ImageProps } from './_Image.js';
4
4
  export type TextCardProps = {
5
5
  title: string;
6
6
  href: string;
7
+ meta?: string | JSX.Element;
7
8
  summary?: string | JSX.Element;
8
9
  target?: React.HTMLAttributeAnchorTarget;
9
10
  };
10
11
  export type ImageCardProps = TextCardProps & {
11
- meta?: string;
12
12
  image?: ImageProps;
13
13
  imgPlaceholder?: boolean;
14
14
  };
@@ -11,7 +11,7 @@ const Card = (props) => {
11
11
  return (react_1.default.createElement(react_1.default.Fragment, null,
12
12
  react_1.default.createElement(_Button_js_1.Button, { bem: cardClass, href: href, target: target },
13
13
  ' ',
14
- react_1.default.createElement(_Image_js_1.Image, Object.assign({ className: `${bem}__image` }, image, { placeholder: imgPlaceholder })),
14
+ !!(image || imgPlaceholder) && (react_1.default.createElement(_Image_js_1.Image, Object.assign({ className: `${bem}__image` }, image, { placeholder: imgPlaceholder }))),
15
15
  react_1.default.createElement("span", { className: `${cardClass}__title` }, title),
16
16
  ' ',
17
17
  meta && react_1.default.createElement("span", { className: `${cardClass}__meta` }, meta),
@@ -1,4 +1,4 @@
1
- import { TextCardListProps } from './_abstract/_CardList.js';
1
+ import { CardListProps, TextCardProps } from './_abstract/_CardList.js';
2
2
  import { SeenProp } from './utils/seenEffect.js';
3
3
  export type RelatedLink = {
4
4
  href: string;
@@ -10,8 +10,8 @@ type RelatedProps = {
10
10
  relatedTitle?: string;
11
11
  relatedLinks?: Array<RelatedLink>;
12
12
  };
13
- export type ExtraLinksCardProps = TextCardListProps['cards'][number];
14
- export type ExtraLinksProps = TextCardListProps & RelatedProps & {
13
+ export type ExtraLinksCardProps = Omit<TextCardProps, 'meta'>;
14
+ export type ExtraLinksProps = CardListProps<ExtraLinksCardProps> & RelatedProps & {
15
15
  className?: string;
16
16
  } & SeenProp;
17
17
  export declare const ExtraLinks: (props: ExtraLinksProps) => JSX.Element;
@@ -4,11 +4,11 @@ import { ImageProps } from './_Image.js';
4
4
  export type TextCardProps = {
5
5
  title: string;
6
6
  href: string;
7
+ meta?: string | JSX.Element;
7
8
  summary?: string | JSX.Element;
8
9
  target?: React.HTMLAttributeAnchorTarget;
9
10
  };
10
11
  export type ImageCardProps = TextCardProps & {
11
- meta?: string;
12
12
  image?: ImageProps;
13
13
  imgPlaceholder?: boolean;
14
14
  };
@@ -7,7 +7,7 @@ const Card = (props) => {
7
7
  return (React.createElement(React.Fragment, null,
8
8
  React.createElement(Button, { bem: cardClass, href: href, target: target },
9
9
  ' ',
10
- React.createElement(Image, Object.assign({ className: `${bem}__image` }, image, { placeholder: imgPlaceholder })),
10
+ !!(image || imgPlaceholder) && (React.createElement(Image, Object.assign({ className: `${bem}__image` }, image, { placeholder: imgPlaceholder }))),
11
11
  React.createElement("span", { className: `${cardClass}__title` }, title),
12
12
  ' ',
13
13
  meta && React.createElement("span", { className: `${cardClass}__meta` }, meta),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reykjavik/hanna-react",
3
- "version": "0.10.98",
3
+ "version": "0.10.99",
4
4
  "author": "Reykjavík (http://www.reykjavik.is)",
5
5
  "contributors": [
6
6
  "Hugsmiðjan ehf (http://www.hugsmidjan.is)",