|
6 | 6 | <h1 class="text-2xl font-bold mb-2" style="color: var(--ds-text);">ItemKey</h1> |
7 | 7 | <p class="mb-8" style="color: var(--ds-text-subtle);"> |
8 | 8 | Standard display component for work item keys. Shows the workspace key with the item number in a consistent format. |
| 9 | + Styling is baked in: <code>text-xs font-mono</code> with <code>var(--ds-text-subtle)</code> color by default. |
| 10 | + Interactive variants (href or onClick) automatically add <code>hover:underline cursor-pointer</code>. |
9 | 11 | </p> |
10 | 12 |
|
11 | 13 | <!-- Basic Usage --> |
|
43 | 45 | <section class="mb-10"> |
44 | 46 | <h2 class="text-lg font-semibold mb-4" style="color: var(--ds-text);">As Link</h2> |
45 | 47 | <p class="mb-4 text-sm" style="color: var(--ds-text-subtle);"> |
46 | | - When <code>href</code> is provided, renders as a clickable link. |
| 48 | + When <code>href</code> is provided, renders as a clickable link with hover:underline. |
47 | 49 | </p> |
48 | 50 | <div class="flex items-center gap-4"> |
49 | 51 | <ItemKey |
50 | 52 | item={{ workspace_item_number: 42 }} |
51 | 53 | workspace={{ key: 'PROJ' }} |
52 | 54 | href="#/workspace/PROJ/item/42" |
53 | | - className="text-xs font-mono text-blue-600 hover:underline" |
54 | 55 | /> |
55 | 56 | <ItemKey |
56 | 57 | item={{ workspace_item_number: 123 }} |
57 | 58 | workspace={{ key: 'WIND' }} |
58 | 59 | href="#/workspace/WIND/item/123" |
59 | | - className="text-xs font-mono text-blue-600 hover:underline" |
60 | 60 | /> |
61 | 61 | </div> |
62 | 62 | </section> |
63 | 63 |
|
64 | | - <!-- Custom Styling --> |
| 64 | + <!-- With onClick (Button) --> |
65 | 65 | <section class="mb-10"> |
66 | | - <h2 class="text-lg font-semibold mb-4" style="color: var(--ds-text);">Custom Styling</h2> |
67 | | - <div class="flex items-center gap-4"> |
68 | | - <ItemKey |
69 | | - item={{ workspace_item_number: 42 }} |
70 | | - workspace={{ key: 'PROJ' }} |
71 | | - className="text-sm font-mono text-gray-900 font-semibold" |
72 | | - /> |
| 66 | + <h2 class="text-lg font-semibold mb-4" style="color: var(--ds-text);">With onClick (Button)</h2> |
| 67 | + <p class="mb-4 text-sm" style="color: var(--ds-text-subtle);"> |
| 68 | + When <code>onClick</code> is provided without <code>href</code>, renders as a <code><button></code> with hover:underline. |
| 69 | + </p> |
| 70 | + <ItemKey |
| 71 | + item={{ workspace_item_number: 42 }} |
| 72 | + workspace={{ key: 'PROJ' }} |
| 73 | + onClick={() => alert('Clicked PROJ-42')} |
| 74 | + /> |
| 75 | + </section> |
| 76 | + |
| 77 | + <!-- Custom Style Override --> |
| 78 | + <section class="mb-10"> |
| 79 | + <h2 class="text-lg font-semibold mb-4" style="color: var(--ds-text);">Custom Style Override</h2> |
| 80 | + <p class="mb-4 text-sm" style="color: var(--ds-text-subtle);"> |
| 81 | + Use the <code>style</code> prop to override the default color (e.g. for gradient backgrounds). |
| 82 | + </p> |
| 83 | + <div class="flex items-center gap-4 p-4 rounded-lg" style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);"> |
73 | 84 | <ItemKey |
74 | 85 | item={{ workspace_item_number: 42 }} |
75 | 86 | workspace={{ key: 'PROJ' }} |
76 | | - className="text-xs font-mono bg-gray-100 px-2 py-1 rounded" |
| 87 | + style="color: rgba(255,255,255,0.7);" |
77 | 88 | /> |
78 | 89 | <ItemKey |
79 | | - item={{ workspace_item_number: 42 }} |
80 | | - workspace={{ key: 'PROJ' }} |
81 | | - className="text-xs font-mono bg-blue-100 text-blue-800 px-2 py-1 rounded" |
| 90 | + item={{ workspace_item_number: 123 }} |
| 91 | + workspace={{ key: 'WIND' }} |
| 92 | + href="#" |
| 93 | + style="color: rgba(255,255,255,0.7);" |
82 | 94 | /> |
83 | 95 | </div> |
84 | 96 | </section> |
|
99 | 111 | <ItemKey |
100 | 112 | item={{ workspace_item_number: item.number }} |
101 | 113 | workspace={{ key: 'PROJ' }} |
102 | | - className="text-xs font-mono text-gray-500" |
103 | 114 | /> |
104 | 115 | <span class="text-sm" style="color: var(--ds-text);">{item.title}</span> |
105 | 116 | </div> |
106 | 117 | {/each} |
107 | 118 | </div> |
108 | 119 | </section> |
109 | 120 |
|
110 | | - <!-- With Click Handler --> |
111 | | - <section class="mb-10"> |
112 | | - <h2 class="text-lg font-semibold mb-4" style="color: var(--ds-text);">With Click Handler</h2> |
113 | | - <p class="mb-4 text-sm" style="color: var(--ds-text-subtle);"> |
114 | | - Use <code>onClick</code> for custom behavior like opening a modal while preserving link benefits. |
115 | | - </p> |
116 | | - <ItemKey |
117 | | - item={{ workspace_item_number: 42 }} |
118 | | - workspace={{ key: 'PROJ' }} |
119 | | - href="#/item/42" |
120 | | - onClick={(e) => { |
121 | | - e.preventDefault() |
122 | | - alert('Would open item modal for PROJ-42') |
123 | | - }} |
124 | | - className="text-xs font-mono text-blue-600 hover:underline cursor-pointer" |
125 | | - /> |
126 | | - </section> |
127 | | - |
128 | 121 | <!-- Props Reference --> |
129 | 122 | <section class="mb-10"> |
130 | 123 | <h2 class="text-lg font-semibold mb-4" style="color: var(--ds-text);">Props Reference</h2> |
|
162 | 155 | <td class="p-2">null</td> |
163 | 156 | </tr> |
164 | 157 | <tr> |
165 | | - <td class="p-2"><code>className</code></td> |
| 158 | + <td class="p-2"><code>style</code></td> |
166 | 159 | <td class="p-2">string</td> |
167 | | - <td class="p-2">'text-xs font-mono text-gray-500'</td> |
| 160 | + <td class="p-2">"color: var(--ds-text-subtle);"</td> |
168 | 161 | </tr> |
169 | 162 | </tbody> |
170 | 163 | </table> |
|
0 commit comments