diff --git a/src/components/pages/Publish/Preview.module.css b/src/components/pages/Publish/Preview.module.css new file mode 100644 index 000000000..731515f85 --- /dev/null +++ b/src/components/pages/Publish/Preview.module.css @@ -0,0 +1,31 @@ +.preview { + font-size: var(--font-size-small); + margin-bottom: var(--spacer); +} + +.preview header { + margin-bottom: var(--spacer); +} + +.metaFull { + display: grid; + gap: var(--spacer); + grid-template-columns: 1fr 1fr; +} + +.preview h2 { + font-size: var(--font-size-h3); + margin-bottom: calc(var(--spacer) / 2); +} + +.preview h3 { + margin-bottom: calc(var(--spacer) / 12); +} + +.preview [class*='MetaItem-module--metaItem'] { + margin-bottom: calc(var(--spacer) / 2); +} + +.file { + margin-bottom: calc(var(--spacer) / 2); +} diff --git a/src/components/pages/Publish/Preview.tsx b/src/components/pages/Publish/Preview.tsx new file mode 100644 index 000000000..cf32dd734 --- /dev/null +++ b/src/components/pages/Publish/Preview.tsx @@ -0,0 +1,48 @@ +import React, { ReactElement } from 'react' +import { File as FileMetadata } from '@oceanprotocol/lib/dist/node/ddo/interfaces/File' +import Markdown from '../../atoms/Markdown' +import Tags from '../../atoms/Tags' +import MetaItem from '../../organisms/AssetContent/MetaItem' +import styles from './Preview.module.css' +import File from '../../atoms/File' +import { MetadataPublishForm } from '../../../@types/Metadata' + +export default function Preview({ + values +}: { + values: MetadataPublishForm +}): ReactElement { + return ( +
+
+

{values.name}

+ {values.description && } + {values.files && values.files.length && ( + + )} + {values.tags && } +
+ +
+ {Object.entries(values) + .filter( + ([key, value]) => + !( + key.includes('name') || + key.includes('description') || + key.includes('tags') || + key.includes('files') || + key.includes('termsAndConditions') + ) + ) + .map(([key, value]) => ( + + ))} +
+
+ ) +} diff --git a/src/components/pages/Publish/index.module.css b/src/components/pages/Publish/index.module.css index 518794f2b..0e0cb63ae 100644 --- a/src/components/pages/Publish/index.module.css +++ b/src/components/pages/Publish/index.module.css @@ -15,34 +15,3 @@ top: calc(var(--spacer) / 2); } } - -.preview { - font-size: var(--font-size-small); - margin-bottom: var(--spacer); -} - -.preview header { - margin-bottom: var(--spacer); -} - -.metaFull { - display: grid; - gap: var(--spacer); - grid-template-columns: 1fr 1fr; -} - -.preview h2 { - margin-bottom: calc(var(--spacer) / 2); -} - -.preview h3 { - margin-bottom: calc(var(--spacer) / 12); -} - -.preview [class*='MetaItem-module--metaItem'] { - margin-bottom: calc(var(--spacer) / 2); -} - -.file { - margin-bottom: calc(var(--spacer) / 2); -} diff --git a/src/components/pages/Publish/index.tsx b/src/components/pages/Publish/index.tsx index 02a568b8b..737f386f0 100644 --- a/src/components/pages/Publish/index.tsx +++ b/src/components/pages/Publish/index.tsx @@ -1,22 +1,17 @@ import React, { ReactElement } from 'react' import { useNavigate } from '@reach/router' -import PublishForm from './PublishForm' -import { File as FileMetadata } from '@oceanprotocol/lib/dist/node/ddo/interfaces/File' +import { toast } from 'react-toastify' +import { Formik } from 'formik' +import { usePublish } from '@oceanprotocol/react' import styles from './index.module.css' +import PublishForm from './PublishForm' import Web3Feedback from '../../molecules/Wallet/Feedback' import { FormContent } from '../../../@types/Form' -import { Formik } from 'formik' import { initialValues, validationSchema } from './validation' -import { usePublish } from '@oceanprotocol/react' import { useSiteMetadata } from '../../../hooks/useSiteMetadata' import { MetadataPublishForm } from '../../../@types/Metadata' import { transformPublishFormToMetadata } from './utils' -import { toast } from 'react-toastify' -import Markdown from '../../atoms/Markdown' -import Tags from '../../atoms/Tags' -import MetaItem from '../../organisms/AssetContent/MetaItem' -import FileInfo from '../../molecules/FormFields/FilesInput/Info' -import File from '../../atoms/File' +import Preview from './Preview' export default function PublishPage({ content @@ -84,39 +79,7 @@ export default function PublishPage({