mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-05 06:41:50 +09:00
Closes https://github.com/webstudio-is/webstudio/issues/5507 ## Description 1. What is this PR about (link the issue and add a short description) ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 0000) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
27 lines
676 B
TypeScript
27 lines
676 B
TypeScript
/**
|
|
* @deprecated This component will be replaced by the Element component in the future.
|
|
* Use Element with tag="h1", "h2", etc. instead.
|
|
*/
|
|
import {
|
|
forwardRef,
|
|
type ElementRef,
|
|
type ComponentProps,
|
|
createElement,
|
|
} from "react";
|
|
import { getTagFromProps } from "@webstudio-is/sdk/runtime";
|
|
|
|
const defaultTag = "h1";
|
|
|
|
type Props = ComponentProps<typeof defaultTag> & {
|
|
tag?: string;
|
|
};
|
|
|
|
export const Heading = forwardRef<ElementRef<typeof defaultTag>, Props>(
|
|
({ tag: legacyTag, ...props }, ref) => {
|
|
const tag = getTagFromProps(props) ?? legacyTag ?? defaultTag;
|
|
return createElement(tag, { ...props, ref });
|
|
}
|
|
);
|
|
|
|
Heading.displayName = "Heading";
|