@conduction/docusaurus-preset 3.2.0 → 3.3.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduction/docusaurus-preset",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "scripts": {
5
5
  "prepack": "node scripts/prepack-bundle-css.js"
6
6
  },
@@ -47,17 +47,35 @@ import styles from './FeatureGrid.module.css';
47
47
 
48
48
  const STATUS_CLASSES = {stable: '', beta: styles.beta, soon: styles.soon};
49
49
 
50
- export function FeatureItem({label, tip, status = 'stable', className}) {
50
+ export function FeatureItem({label, tip, status = 'stable', href, className}) {
51
51
  const hexClass = [styles.h, STATUS_CLASSES[status]].filter(Boolean).join(' ');
52
+ const body = (
53
+ <>
54
+ <span className={hexClass} aria-hidden="true" />
55
+ <span className={styles.label}>{label}</span>
56
+ {tip && <span className={styles.tip}>{tip}</span>}
57
+ </>
58
+ );
59
+ if (href) {
60
+ const isExternal = /^https?:\/\//.test(href);
61
+ return (
62
+ <a
63
+ className={[styles.item, styles.itemLink, className].filter(Boolean).join(' ')}
64
+ href={href}
65
+ title={tip || label}
66
+ {...(isExternal ? {target: '_blank', rel: 'noopener noreferrer'} : {})}
67
+ >
68
+ {body}
69
+ </a>
70
+ );
71
+ }
52
72
  return (
53
73
  <div
54
74
  className={[styles.item, className].filter(Boolean).join(' ')}
55
75
  tabIndex={0}
56
76
  title={tip || label}
57
77
  >
58
- <span className={hexClass} aria-hidden="true" />
59
- <span className={styles.label}>{label}</span>
60
- {tip && <span className={styles.tip}>{tip}</span>}
78
+ {body}
61
79
  </div>
62
80
  );
63
81
  }
@@ -46,6 +46,23 @@
46
46
  margin-right: -8px;
47
47
  }
48
48
 
49
+ .itemLink {
50
+ text-decoration: none;
51
+ color: inherit;
52
+ cursor: pointer;
53
+ }
54
+ .itemLink:hover,
55
+ .itemLink:focus-visible {
56
+ color: var(--c-cobalt-900);
57
+ text-decoration: none;
58
+ }
59
+ .itemLink:hover .label,
60
+ .itemLink:focus-visible .label {
61
+ text-decoration: underline;
62
+ text-decoration-color: var(--c-cobalt-400);
63
+ text-underline-offset: 3px;
64
+ }
65
+
49
66
  .h {
50
67
  width: 10px;
51
68
  height: 12px;