Skip to content

Commit

Permalink
move dialog to shared and collapse inside of dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
jonesmac committed Mar 8, 2024
1 parent a54e6ef commit df9f44d
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Payload, WithSchema } from '@xyo-network/payload-model'
import { MouseEventHandler, ReactNode, useState } from 'react'

import { ExpansionProps } from '../../lib'
import { RawInfoDialog } from '../Dialog'
import { xyoColorLogo } from '../img'
import { RawInfoDialog } from '../shared'
import { IconSize, presetIconSizeValue } from './lib'

export interface RawInfoButtonProps extends ButtonExProps, ExpansionProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Payload } from '@xyo-network/payload-model'
import { forwardRef, MouseEventHandler, ReactNode, useState } from 'react'

import { ExpansionProps } from '../../lib'
import { RawInfoDialog } from '../Dialog'
import { xyoColorLogo } from '../img'
import { RawInfoDialog } from '../shared'
import { IconSize, presetIconSizeValue } from './lib'

export interface RawInfoIconProps extends IconButtonProps, ExpansionProps {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './Button'
export * from './Dialog'
export * from './shared'
export * from './styled'
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { PayloadBuilder } from '@xyo-network/payload-builder'
import { Payload } from '@xyo-network/payload-model'
import { useDataState } from '@xyo-network/react-shared'

import { ExpansionProps } from '../../lib'
import { StyledChipLabel } from '../styled'
import { JsonViewerEx } from './JsonViewerEx'
import { ExpansionProps } from '../../../lib'
import { StyledChipLabel } from '../../styled'
import { JsonViewerEx } from '../JsonViewerEx'

export interface RawInfoPayloadCollapse extends CollapseProps, ExpansionProps {
payload?: Payload | null
Expand All @@ -16,6 +16,7 @@ export interface RawInfoPayloadCollapse extends CollapseProps, ExpansionProps {
export const RawInfoPayloadCollapse: React.FC<RawInfoPayloadCollapse> = ({ defaultExpandedJson, payload, updateExpandedJson, ...props }) => {
const [expandedJson, setExpandedJson] = useDataState(defaultExpandedJson)
const [hash] = usePromise(async () => (payload ? await PayloadBuilder.dataHash(payload) : undefined), [payload])
const actionText = expandedJson ? 'Hide JSON' : 'Show JSON'

const handleExpansion = () => {
updateExpandedJson?.(!expandedJson)
Expand All @@ -27,7 +28,7 @@ export const RawInfoPayloadCollapse: React.FC<RawInfoPayloadCollapse> = ({ defau
{payload ?
<FlexRow>
<Button onClick={handleExpansion} size="small" variant="outlined">
Show Raw JSON
{actionText}
</Button>
</FlexRow>
: null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Button, Dialog, DialogActions, DialogContent, DialogProps, DialogTitle
import { Payload } from '@xyo-network/payload-model'
import { MouseEventHandler, ReactNode } from 'react'

import { ExpansionProps } from '../../lib'
import { RawInfoPayloadCollapse } from '../shared'
import { ExpansionProps } from '../../../lib'
import { RawInfoPayloadCollapse } from './PayloadCollapse'

export interface RawInfoDialogProps extends DialogProps, ExpansionProps {
dialogContent?: ReactNode
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './PayloadCollapse'
export * from './RawInfoDialog'
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './Dialog'
export * from './JsonViewerEx'
export * from './PayloadCollapse'

0 comments on commit df9f44d

Please sign in to comment.