diff --git a/src/components/chemistry/pubchem/Vp.tsx b/src/components/chemistry/pubchem/Vp.tsx new file mode 100644 index 0000000..704bafb --- /dev/null +++ b/src/components/chemistry/pubchem/Vp.tsx @@ -0,0 +1,38 @@ +export default function Vp(props: { + data: { + temperature: { + low: number; + high: number; + units: string; + }; + pressure: { + low: number; + high: number; + units: string; + }; + }; +}) { + if (!props.data?.pressure?.low) return <>; + const { temperature, pressure } = props.data; + + let pressureLow = + String(pressure.low).length > 10 + ? pressure.low.toPrecision(4) + : pressure.low; + + let pressureHigh = + String(pressure.high).length > 10 + ? pressure.high.toPrecision(4) + : pressure.high; + + return ( + + {pressureLow} + {pressureHigh && `-${pressureHigh}`} + {pressure.units && ` ${pressure.units}`} + {temperature && + temperature.low && + ` (${temperature.low} ${temperature.units})`} + + ); +} diff --git a/src/components/chemistry/pubchem/experimental/BpTable.tsx b/src/components/chemistry/pubchem/experimental/BpTable.tsx new file mode 100644 index 0000000..a142b0e --- /dev/null +++ b/src/components/chemistry/pubchem/experimental/BpTable.tsx @@ -0,0 +1,45 @@ +import { SvgOutlineExternalLink } from '@/components/tailwind-ui'; + +import Bp from '../Bp'; +import { CompactTable, Td, Th } from '../CompactTable'; + +export default function BpTable(props: { data: any }) { + const { data } = props; + if (!data) return <>; + return ( +
+
Boiling point
+ +
+ ); +} + +function Header() { + return ( + + Original value + Parsed + Reference + + ); +} + +function Row(props: any) { + const value = props.value; + return ( + + {value.data.original} + + + + +
+ {value.reference.sourceName}{' '} + + + +
+ + + ); +} diff --git a/src/components/chemistry/pubchem/experimental/Experimental.tsx b/src/components/chemistry/pubchem/experimental/Experimental.tsx index f8dfd2c..90c3001 100644 --- a/src/components/chemistry/pubchem/experimental/Experimental.tsx +++ b/src/components/chemistry/pubchem/experimental/Experimental.tsx @@ -1,30 +1,18 @@ -import Bp from '../Bp'; -import LowHighUnits from '../LowHighUnits'; - -import OnePropertyTable from './OnePropertyTable'; +import BpTable from './BpTable'; +import FlashPointTable from './FlashPointTable'; +import MpTable from './MpTable'; +import SolubilityTable from './SolubilityTable'; +import VaporPressureTable from './VaporPressureTable'; export default function Experimental(props: { experimental: any }) { const { experimental } = props; - - const components = []; - for (let key in experimental) { - let parsedRenderer: any = LowHighUnits; - switch (key) { - case 'boilingPoint': - parsedRenderer = Bp; - break; - default: - } - components.push( -
-
{key}
- -
, - ); - } - - return
{components}
; + return ( +
+ + + + + +
+ ); } diff --git a/src/components/chemistry/pubchem/experimental/FlashPointTable.tsx b/src/components/chemistry/pubchem/experimental/FlashPointTable.tsx new file mode 100644 index 0000000..75d0b01 --- /dev/null +++ b/src/components/chemistry/pubchem/experimental/FlashPointTable.tsx @@ -0,0 +1,45 @@ +import { SvgOutlineExternalLink } from '@/components/tailwind-ui'; + +import { CompactTable, Td, Th } from '../CompactTable'; +import LowHighUnits from '../LowHighUnits'; + +export default function FlashPointTable(props: { data: any }) { + const { data } = props; + if (!data) return <>; + return ( +
+
Flash point
+ +
+ ); +} + +function Header() { + return ( + + Original value + Parsed + Reference + + ); +} + +function Row(props: any) { + const value = props.value; + return ( + + {value.data.original} + + + + +
+ {value.reference.sourceName}{' '} + + + +
+ + + ); +} diff --git a/src/components/chemistry/pubchem/experimental/MpTable.tsx b/src/components/chemistry/pubchem/experimental/MpTable.tsx new file mode 100644 index 0000000..b93bfb7 --- /dev/null +++ b/src/components/chemistry/pubchem/experimental/MpTable.tsx @@ -0,0 +1,45 @@ +import { SvgOutlineExternalLink } from '@/components/tailwind-ui'; + +import { CompactTable, Td, Th } from '../CompactTable'; +import LowHighUnits from '../LowHighUnits'; + +export default function MpTable(props: { data: any }) { + const { data } = props; + if (!data) return <>; + return ( +
+
Melting point
+ +
+ ); +} + +function Header() { + return ( + + Original value + Parsed + Reference + + ); +} + +function Row(props: any) { + const value = props.value; + return ( + + {value.data.original} + + + + +
+ {value.reference.sourceName}{' '} + + + +
+ + + ); +} diff --git a/src/components/chemistry/pubchem/experimental/OnePropertyTable.tsx b/src/components/chemistry/pubchem/experimental/OnePropertyTable.tsx deleted file mode 100644 index 315bb11..0000000 --- a/src/components/chemistry/pubchem/experimental/OnePropertyTable.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { SvgOutlineExternalLink } from '@/components/tailwind-ui'; - -import { CompactTable, Td, Th } from '../CompactTable'; - -export default function OnePropertyTable(props: { - data: any; - parsedRenderer: any; -}) { - const { data, parsedRenderer } = props; - - return ; - - function Row(props: any) { - const value = props.value; - return ( - - {value.data.original} - {parsedRenderer({ data: value?.data?.parsed })} - -
- {value.reference.sourceName}{' '} - - - -
- - - ); - } -} - -function Header() { - return ( - - Original value - Parsed - Reference - - ); -} diff --git a/src/components/chemistry/pubchem/experimental/SolubilityTable.tsx b/src/components/chemistry/pubchem/experimental/SolubilityTable.tsx new file mode 100644 index 0000000..c820339 --- /dev/null +++ b/src/components/chemistry/pubchem/experimental/SolubilityTable.tsx @@ -0,0 +1,40 @@ +import { SvgOutlineExternalLink } from '@/components/tailwind-ui'; + +import { CompactTable, Td, Th } from '../CompactTable'; + +export default function SolubilityTable(props: { data: any }) { + const { data } = props; + if (!data) return <>; + return ( +
+
Solubility
+ +
+ ); +} + +function Header() { + return ( + + Original value + Reference + + ); +} + +function Row(props: any) { + const value = props.value; + return ( + + {value.data.original} + +
+ {value.reference.sourceName}{' '} + + + +
+ + + ); +} diff --git a/src/components/chemistry/pubchem/experimental/VaporPressureTable.tsx b/src/components/chemistry/pubchem/experimental/VaporPressureTable.tsx new file mode 100644 index 0000000..d7e1aa5 --- /dev/null +++ b/src/components/chemistry/pubchem/experimental/VaporPressureTable.tsx @@ -0,0 +1,45 @@ +import { SvgOutlineExternalLink } from '@/components/tailwind-ui'; + +import { CompactTable, Td, Th } from '../CompactTable'; +import Vp from '../Vp'; + +export default function VaporPressureTable(props: { data: any }) { + const { data } = props; + if (!data) return <>; + return ( +
+
Vapor pressure
+ +
+ ); +} + +function Header() { + return ( + + Original value + Parsed + Reference + + ); +} + +function Row(props: any) { + const value = props.value; + return ( + + {value.data.original} + + + + +
+ {value.reference.sourceName}{' '} + + + +
+ + + ); +}