Files
pezkuwi-dev/packages/dev/src/rootJs/Jsx.tsx
T
pezkuwichain 8d28b36f9c Initial rebrand: @polkadot -> @pezkuwi (3 packages)
- Package namespace: @polkadot/dev -> @pezkuwi/dev
- Repository: polkadot-js/dev -> pezkuwichain/pezkuwi-dev
- Author: Pezkuwi Team <team@pezkuwichain.io>

Packages:
- @pezkuwi/dev (build tools, linting, CI scripts)
- @pezkuwi/dev-test (test runner)
- @pezkuwi/dev-ts (TypeScript build)

Upstream: polkadot-js/dev v0.83.3
2026-01-05 14:22:47 +03:00

46 lines
1.1 KiB
TypeScript

// Copyright 2017-2025 @polkadot/dev authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Adapted from https://github.com/testing-library/react-testing-library#basic-example
import type { Props } from './JsxChild.js';
import React, { useCallback, useState } from 'react';
import { styled } from 'styled-components';
import Child from './JsxChild.js';
function Hidden ({ children, className }: Props): React.ReactElement<Props> {
const [isMessageVisible, setMessageVisibility] = useState(false);
const onShow = useCallback(
(e: React.ChangeEvent<HTMLInputElement>) =>
setMessageVisibility(e.target.checked),
[]
);
return (
<StyledDiv className={className}>
<label htmlFor='toggle'>Show Message</label>
<input
checked={isMessageVisible}
id='toggle'
onChange={onShow}
type='checkbox'
/>
{isMessageVisible && (
<>
{children}
<Child label='hello' />
</>
)}
</StyledDiv>
);
}
const StyledDiv = styled.div`
background: red;
`;
export default React.memo(Hidden);