Skip to content

Commit

Permalink
chore: update Text element
Browse files Browse the repository at this point in the history
  • Loading branch information
hta218 committed May 23, 2023
1 parent e0ec292 commit 6aa89c2
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions app/weaverse/components/text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,24 @@ import type {
import React from 'react';
import {forwardRef} from 'react';

export interface TextProps extends HydrogenComponentProps {
tagName: string;
className?: string;
text: string;
}
export interface TextProps
extends HydrogenComponentProps<{
tagName: string;
text: string;
}> {}

let Text = forwardRef<HTMLElement, TextProps>((props, ref) => {
console.log('👉 --------> - props:', props)
let {text, tagName, ...rest} = props;
let {data, ...rest} = props;
let {tagName, text} = data;
return React.createElement(tagName, {ref, ...rest}, text);
});

Text.defaultProps = {
tagName: 'h1',
text: 'The quick brown fox jumps over the lazy dog hehe',
className: 'title-font sm:text-4xl text-3xl mb-4 font-medium text-gray-900',
data: {
tagName: 'h1',
text: 'The quick brown fox jumps over the lazy dog hehe',
className: 'title-font sm:text-4xl text-3xl mb-4 font-medium text-gray-900',
},
};

export let schema: HydrogenComponentSchema = {
Expand Down

0 comments on commit 6aa89c2

Please sign in to comment.