Skip to content

Commit

Permalink
fixup! UNSAFE classname test
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelklibani committed Dec 18, 2024
1 parent d8cc0a0 commit ca89643
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import React from 'react';

const RandomComponent = (props: any) => {
const OutsideComponent = (props: any) => {
return <p {...props}>{props.children}</p>;
};

export default RandomComponent;
export default OutsideComponent;
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React, { ElementType, ReactNode } from 'react';
import { StyleProps, TransferProps } from '../../../../../../packages/web-react/src/types';
// import { useStyleProps } from './originalStyleProps';
import { useStyleProps } from './newStyleProps';
import classNames from 'classnames';

interface TestComponentProps extends StyleProps, TransferProps {
elementType?: ElementType | string;
Expand Down
6 changes: 3 additions & 3 deletions examples/next-with-app-router/src/app/test1/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Container, Heading, Text as SpiritText } from '@lmc-eu/spirit-web-react';
import TestComponent from './components/TestComponent';
import RandomComponent from './components/RandomComponent';
import OutsideComponent from './components/OutsideComponent';

const page = () => {
return (
Expand All @@ -28,7 +28,7 @@ const page = () => {
Spirit Text component with UNSAFE class and style
</TestComponent>

<TestComponent elementType={RandomComponent} className="test" style={{ color: 'green' }}>
<TestComponent elementType={OutsideComponent} className="test" style={{ color: 'green' }}>
Random component with class and style
</TestComponent>
</>
Expand All @@ -46,7 +46,7 @@ const page = () => {
</TestComponent>

{/* This will not be working - Random component doesn't know what UNSAFE style props are */}
<TestComponent elementType={RandomComponent} UNSAFE_className="test" UNSAFE_style={{ color: 'green' }}>
<TestComponent elementType={OutsideComponent} UNSAFE_className="test" UNSAFE_style={{ color: 'green' }}>
Random component with UNSAFE class and style
</TestComponent>
</>
Expand Down

0 comments on commit ca89643

Please sign in to comment.