Fix directives

Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
This commit is contained in:
Charles de Dreuille
2025-01-27 10:42:48 +00:00
parent b9d2914d5e
commit 6ec2d17ced
9 changed files with 20 additions and 14 deletions
@@ -1,5 +1,4 @@
import { PropsTable } from '@/components/PropsTable';
import { icons } from '@backstage/canon';
import { IconPreview } from '@/snippets/icon';
import { Snippet } from '@/components/Snippet';
import { Tabs } from '@/components/Tabs';
@@ -44,7 +43,7 @@ Icons are used to represent an action or a state.
<PropsTable
data={{
name: {
type: Object.keys(icons),
type: 'icon',
responsive: false,
},
size: {
@@ -1,6 +1,7 @@
'use client';
import { Icon, Text } from '../../../../packages/canon';
import styles from './styles.module.css';
import { Text } from '../../../../packages/canon/src/components/Text';
import { Icon } from '../../../../packages/canon/src/components/Icon';
interface BaseUIProps {
href: string;
@@ -13,12 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use client';
import React from 'react';
import { Icon } from '../../../../packages/canon/src/components/Icon';
import type { IconNames } from '../../../../packages/canon/src/components/Icon';
import { Text } from '../../../../packages/canon/src/components/Text';
import { icons } from '../../../../packages/canon/src/components/Icon/icons';
import { Text, Icon, icons } from '../../../../packages/canon';
import type { IconNames } from '../../../../packages/canon';
import styles from './styles.module.css';
export const IconLibrary = () => {
@@ -1,6 +1,8 @@
import React from 'react';
'use client';
import * as Table from '../Table';
import { Chip } from '../Chip';
import { icons } from '../../../../packages/canon';
// Define a more specific type for the data object
type PropData = {
@@ -33,7 +35,9 @@ export const PropsTable = <T extends Record<string, PropData>>({
<div
style={{ display: 'flex', flexWrap: 'wrap', gap: '0.375rem' }}
>
{Array.isArray(data[n].type) ? (
{data[n].type === 'icon' ? (
Object.keys(icons).map(icon => <Chip key={icon}>{icon}</Chip>)
) : Array.isArray(data[n].type) ? (
data[n].type.map(t => <Chip key={t}>{t}</Chip>)
) : (
<Chip>{data[n].type}</Chip>
+1 -2
View File
@@ -1,6 +1,5 @@
import { ReactNode } from 'react';
import { CodeBlock } from '../CodeBlock';
import { Text } from '../../../../packages/canon/src/components/Text';
import { Collapsible } from '@base-ui-components/react/collapsible';
import styles from './styles.module.css';
@@ -31,7 +30,7 @@ export const Snippet = ({
{preview}
</div>
<Collapsible.Trigger className={styles.trigger}>
<Text variant="body">View code</Text>
View code
</Collapsible.Trigger>
</div>
<Collapsible.Panel className={styles.panel}>
@@ -33,6 +33,7 @@
right: 16px;
bottom: 12px;
cursor: pointer;
font-size: 14px;
}
[data-theme='dark'] .previewContent {
+1 -1
View File
@@ -1,8 +1,8 @@
'use client';
import { Tabs as TabsPrimitive } from '@base-ui-components/react/tabs';
import { Text } from '../../../../packages/canon';
import styles from './styles.module.css';
import { Text } from '../../../../packages/canon/src/components/Text';
export const Root = ({
className,
+2
View File
@@ -1,3 +1,5 @@
'use client';
import { Input, Field } from '../../../packages/canon';
export const FieldPreview = () => {
+2
View File
@@ -1,3 +1,5 @@
'use client';
import { Input, Grid } from '../../../packages/canon';
export const InputPreview = () => {