@redocly/theme 0.42.0 → 0.42.1

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.
@@ -9,15 +9,15 @@ const styled_components_1 = __importDefault(require("styled-components"));
9
9
  const ChevronRightIcon_1 = require("../../../icons/ChevronRightIcon/ChevronRightIcon");
10
10
  const CardImage_1 = require("../../../markdoc/components/Cards/CardImage");
11
11
  const CardIcon_1 = require("../../../markdoc/components/Cards/CardIcon");
12
+ const Link_1 = require("../../../components/Link/Link");
12
13
  function Card({ title, image, icon, iconRawContent, imagePosition = 'start', layout = 'vertical', variant = 'filled', lineClamp, iconVariant, align = 'start', to, children, }) {
13
14
  const titleNoSpaces = title.replace(/\s+/g, '-').toLowerCase();
14
15
  const cardTitleId = `card-title-${titleNoSpaces}`;
15
- // Get align values
16
16
  const justifyContent = align === 'center' ? 'center' : align === 'end' ? 'flex-end' : 'flex-start';
17
17
  const alignItems = align === 'center' ? 'center' : align === 'end' ? 'flex-end' : 'flex-start';
18
18
  const textAlign = align === 'center' ? 'center' : align === 'end' ? 'right' : 'left';
19
19
  iconVariant = (iconVariant !== null && iconVariant !== void 0 ? iconVariant : variant === 'ghost') ? 'filled' : 'ghost';
20
- return (react_1.default.createElement(CardWrapper, { as: to ? 'a' : 'div', href: to, "aria-labelledby": cardTitleId, variant: variant, layout: layout, isCardLink: !!to },
20
+ return (react_1.default.createElement(CardWrapper, { as: to ? Link_1.Link : 'div', to: to, "aria-labelledby": cardTitleId, variant: variant, layout: layout, isCardLink: !!to },
21
21
  react_1.default.createElement(react_1.default.Fragment, null,
22
22
  image ? react_1.default.createElement(CardImage_1.CardImage, { src: image, alt: title, position: imagePosition }) : null,
23
23
  react_1.default.createElement(CardContentWrapper, { layout: layout, alignItems: alignItems, textAlign: textAlign, hasImage: image !== undefined },
@@ -47,7 +47,7 @@ exports.card = {
47
47
  type: String,
48
48
  matches: ['filled', 'ghost'],
49
49
  },
50
- to: { type: String },
50
+ to: { type: String, resolver: 'link' },
51
51
  },
52
52
  children: ['paragraph', 'tag', 'list'],
53
53
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.42.0",
3
+ "version": "0.42.1",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -4,6 +4,7 @@ import styled from 'styled-components';
4
4
  import { ChevronRightIcon } from '@redocly/theme/icons/ChevronRightIcon/ChevronRightIcon';
5
5
  import { CardImage } from '@redocly/theme/markdoc/components/Cards/CardImage';
6
6
  import { CardIcon } from '@redocly/theme/markdoc/components/Cards/CardIcon';
7
+ import { Link } from '@redocly/theme/components/Link/Link';
7
8
 
8
9
  export type CardProps = React.PropsWithChildren<{
9
10
  title: string;
@@ -35,7 +36,6 @@ export function Card({
35
36
  }: CardProps) {
36
37
  const titleNoSpaces = title.replace(/\s+/g, '-').toLowerCase();
37
38
  const cardTitleId = `card-title-${titleNoSpaces}`;
38
- // Get align values
39
39
  const justifyContent =
40
40
  align === 'center' ? 'center' : align === 'end' ? 'flex-end' : 'flex-start';
41
41
  const alignItems = align === 'center' ? 'center' : align === 'end' ? 'flex-end' : 'flex-start';
@@ -44,8 +44,8 @@ export function Card({
44
44
 
45
45
  return (
46
46
  <CardWrapper
47
- as={to ? 'a' : 'div'}
48
- href={to}
47
+ as={to ? Link : 'div'}
48
+ to={to}
49
49
  aria-labelledby={cardTitleId}
50
50
  variant={variant}
51
51
  layout={layout}
@@ -47,7 +47,7 @@ export const card: MarkdocSchemaWrapper = {
47
47
  type: String,
48
48
  matches: ['filled', 'ghost'],
49
49
  },
50
- to: { type: String },
50
+ to: { type: String, resolver: 'link' },
51
51
  },
52
52
  children: ['paragraph', 'tag', 'list'],
53
53
  },