Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
feat(react:panel): panel wrapper
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Bogdanov <bbogdanov@vmware.com>
  • Loading branch information
bbogdanov committed Sep 3, 2021
1 parent 19e2a4b commit f625e5b
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/react/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
import { CdsTree, CdsTreeItem } from './dist/react/tree-view/index.js';
import { CdsInternalVisualCheckbox } from './dist/react/visual-checkbox/index.js';
import { CdsInternalCloseButton } from './dist/react/close-button/index.js';
import { CdsInternalPanel } from 'src/panel/index.js';

ClarityIcons.addIcons(userIcon, timesIcon);

Expand Down Expand Up @@ -394,6 +395,9 @@ export default class App extends React.Component<{}, AppState> {
</CdsCard>
</div>

<h2>Internal Panel</h2>
<CdsInternalPanel>Hello!</CdsInternalPanel>

<h2>Forms</h2>
<div cds-layout="vertical gap:lg">
<CdsControl layout="compact">
Expand Down
17 changes: 17 additions & 0 deletions packages/react/src/panel/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CdsInternalPanel snapshot 1`] = `
<div>
<CdsInternalPanel>
<cds-internal-panel(CustomElement)
__forwardedRef={null}
>
<cds-internal-panel
__forwardedRef={null}
>
Hello!
</cds-internal-panel>
</cds-internal-panel(CustomElement)>
</CdsInternalPanel>
</div>
`;
7 changes: 7 additions & 0 deletions packages/react/src/panel/entrypoint.tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.lib.json",
"compilerOptions": {
"composite": true
},
"references": [{ "path": "../converter/entrypoint.tsconfig.json" }]
}
24 changes: 24 additions & 0 deletions packages/react/src/panel/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as React from 'react';
import { mount, shallow } from 'enzyme';
import { CdsInternalPanel } from './index';

describe('CdsInternalPanel', () => {
it('renders', () => {
const wrapper = shallow(
<div>
<CdsInternalPanel>Hello!</CdsInternalPanel>
</div>
);
const renderedComponent = wrapper.find('CdsInternalPanel');
expect(renderedComponent.at(0).html()).toMatch('Hello!');
});

it('snapshot', () => {
const wrapper = mount(
<div>
<CdsInternalPanel>Hello!</CdsInternalPanel>
</div>
);
expect(wrapper).toMatchSnapshot();
});
});
4 changes: 4 additions & 0 deletions packages/react/src/panel/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { CdsInternalPanel as Panel } from '@cds/core/internal-components/panel';
import { createComponent } from '../converter/react-wrapper.js';

export const CdsInternalPanel = createComponent('cds-internal-panel', Panel);
4 changes: 4 additions & 0 deletions packages/react/src/panel/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sideEffects": true,
"name": "@cds/react/internal/panel"
}

0 comments on commit f625e5b

Please sign in to comment.