Skip to content

Commit

Permalink
Merge pull request #133 from basehub-ai/revert-132-rename-svg-icon
Browse files Browse the repository at this point in the history
Revert "Rename SVG -> Icon"
  • Loading branch information
fabroos authored Jan 14, 2025
2 parents 195d3b7 + a17342b commit e12adb8
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 37 deletions.
1 change: 0 additions & 1 deletion packages/basehub/react-icon.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/basehub/react-icon.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/basehub/src/react/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export {
type CustomBlocksBase,
type HandlerProps as RichTextHandlerProps,
} from "./rich-text/primitive";
export { SVG, Icon } from "./icon/primitive";
export { SVG } from "./svg/primitive";
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ const parseStyleString = (styleString: string): React.CSSProperties => {
};

/* COMPONENT */
export const Icon = ({

export const SVG = ({
content: _content,
children,
components = DEFAULT_COMPONENTS,
Expand Down Expand Up @@ -211,11 +212,9 @@ export const Icon = ({
.filter(Boolean);

// Create the component with children if they exist
return children.length > 0 ? (
<Component {...props}>{children}</Component>
) : (
<Component {...props} />
);
return children.length > 0
? React.createElement(tag, props, children)
: React.createElement(tag, props);
};

if (!svgElement) return null;
Expand All @@ -231,29 +230,3 @@ export const Icon = ({

return parseAndRenderSVG as React.ReactElement;
};

interface SVGProps {
content: string;
/**
* @deprecated Use `content` instead.
*/
children?: string;
components?: Partial<ComponentsOverride>;
}

/**
* @deprecated Use the `Icon` component instead.
*/
export const SVG: React.FC<SVGProps> = ({
content: _content,
children,
components = DEFAULT_COMPONENTS,
}) => {
console.warn(
"Warning: The SVG component is deprecated and will be removed in the next major version. Please use the Icon component instead."
);

const content = _content ?? children;

return <Icon content={content} components={components} />;
};
3 changes: 1 addition & 2 deletions packages/basehub/tsup-client.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ export default defineConfig((_options: Options) => {
minify: false,
dts: true,
entry: {
"react-svg": "./src/react/icon/index.ts",
"react-icon": "./src/react/icon/index.ts",
"react-svg": "./src/react/svg/index.ts",
"react-rich-text": "./src/react/rich-text/index.ts",
"react-form": "./src/react/form/index.ts",
"react-code-block/index": "./src/react/code-block/index.ts",
Expand Down

0 comments on commit e12adb8

Please sign in to comment.