mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-04-23 01:17:58 +00:00
feat: initial Pezkuwi Apps rebrand from polkadot-apps
Rebranded terminology: - Polkadot → Pezkuwi - Kusama → Dicle - Westend → Zagros - Rococo → PezkuwiChain - Substrate → Bizinikiwi - parachain → teyrchain Custom logos with Kurdistan brand colors (#e6007a → #86e62a): - bizinikiwi-hexagon.svg - sora-bizinikiwi.svg - hezscanner.svg - heztreasury.svg - pezkuwiscan.svg - pezkuwistats.svg - pezkuwiassembly.svg - pezkuwiholic.svg
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
// Copyright 2017-2025 @pezkuwi/react-params authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Codec } from '@pezkuwi/types/types';
|
||||
import type { RawParam } from '../types.js';
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import { Static, styled } from '@pezkuwi/react-components';
|
||||
|
||||
import { useTranslation } from '../translate.js';
|
||||
import { toHumanJson } from '../valueToText.js';
|
||||
import Bare from './Bare.js';
|
||||
|
||||
interface Props {
|
||||
asHex?: boolean;
|
||||
children?: React.ReactNode;
|
||||
childrenPre?: React.ReactNode;
|
||||
className?: string;
|
||||
defaultValue: RawParam;
|
||||
isOptional?: boolean;
|
||||
label?: React.ReactNode;
|
||||
withLabel?: boolean;
|
||||
}
|
||||
|
||||
function StaticParam ({ asHex, children, childrenPre, className = '', defaultValue, isOptional, label }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const value = useMemo(
|
||||
() => !!defaultValue?.value && (
|
||||
asHex
|
||||
? (defaultValue.value as Codec).toHex()
|
||||
: toHumanJson(
|
||||
(defaultValue.value as Codec).toHuman
|
||||
? (defaultValue.value as Codec).toHuman()
|
||||
: defaultValue.value
|
||||
)
|
||||
),
|
||||
[asHex, defaultValue]
|
||||
);
|
||||
|
||||
return (
|
||||
<StyledBare className={className}>
|
||||
{childrenPre}
|
||||
<Static
|
||||
className='full'
|
||||
label={label}
|
||||
value={<pre>{value || (isOptional ? <> </> : t('<empty>'))}</pre>}
|
||||
/>
|
||||
{children}
|
||||
</StyledBare>
|
||||
);
|
||||
}
|
||||
|
||||
const StyledBare = styled(Bare)`
|
||||
pre {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.ui--Static {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
`;
|
||||
|
||||
export default React.memo(StaticParam);
|
||||
Reference in New Issue
Block a user