add menu dashboard svg
This commit is contained in:
20
src/pages/home/SvgAirDryerA.jsx
Normal file
20
src/pages/home/SvgAirDryerA.jsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Card, Typography, Flex } from 'antd';
|
||||
import { setValSvg } from '../../components/Global/MqttConnection';
|
||||
import SvgTemplate from './SvgTemplate';
|
||||
import SvgViewer from './SvgViewer';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
const filePathSvg = '/svg/air_dryer_A_rev.svg';
|
||||
const topicMqtt = 'PIU_GGCP/Devices/PB';
|
||||
|
||||
const SvgAirDryerA = () => {
|
||||
return (
|
||||
<SvgTemplate>
|
||||
<SvgViewer filePathSvg={filePathSvg} topicMqtt={topicMqtt} setValSvg={setValSvg} />
|
||||
</SvgTemplate>
|
||||
);
|
||||
};
|
||||
|
||||
export default SvgAirDryerA;
|
||||
20
src/pages/home/SvgAirDryerB.jsx
Normal file
20
src/pages/home/SvgAirDryerB.jsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Card, Typography, Flex } from 'antd';
|
||||
import { setValSvg } from '../../components/Global/MqttConnection';
|
||||
import SvgTemplate from './SvgTemplate';
|
||||
import SvgViewer from './SvgViewer';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
const filePathSvg = '/svg/air_dryer_B_rev.svg';
|
||||
const topicMqtt = 'PIU_GGCP/Devices/PB';
|
||||
|
||||
const SvgAirDryerB = () => {
|
||||
return (
|
||||
<SvgTemplate>
|
||||
<SvgViewer filePathSvg={filePathSvg} topicMqtt={topicMqtt} setValSvg={setValSvg} />
|
||||
</SvgTemplate>
|
||||
);
|
||||
};
|
||||
|
||||
export default SvgAirDryerB;
|
||||
20
src/pages/home/SvgAirDryerC.jsx
Normal file
20
src/pages/home/SvgAirDryerC.jsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Card, Typography, Flex } from 'antd';
|
||||
import { setValSvg } from '../../components/Global/MqttConnection';
|
||||
import SvgTemplate from './SvgTemplate';
|
||||
import SvgViewer from './SvgViewer';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
const filePathSvg = '/svg/air_dryer_C_rev.svg';
|
||||
const topicMqtt = 'PIU_GGCP/Devices/PB';
|
||||
|
||||
const SvgAirDryerC = () => {
|
||||
return (
|
||||
<SvgTemplate>
|
||||
<SvgViewer filePathSvg={filePathSvg} topicMqtt={topicMqtt} setValSvg={setValSvg} />
|
||||
</SvgTemplate>
|
||||
);
|
||||
};
|
||||
|
||||
export default SvgAirDryerC;
|
||||
20
src/pages/home/SvgCompressorA.jsx
Normal file
20
src/pages/home/SvgCompressorA.jsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Card, Typography, Flex } from 'antd';
|
||||
import { setValSvg } from '../../components/Global/MqttConnection';
|
||||
import SvgTemplate from './SvgTemplate';
|
||||
import SvgViewer from './SvgViewer';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
const filePathSvg = '/svg/test-new.svg';
|
||||
const topicMqtt = 'PIU_GGCP/Devices/PB';
|
||||
|
||||
const SvgCompressorA = () => {
|
||||
return (
|
||||
<SvgTemplate>
|
||||
<SvgViewer filePathSvg={filePathSvg} topicMqtt={topicMqtt} setValSvg={setValSvg} />
|
||||
</SvgTemplate>
|
||||
);
|
||||
};
|
||||
|
||||
export default SvgCompressorA;
|
||||
20
src/pages/home/SvgCompressorB.jsx
Normal file
20
src/pages/home/SvgCompressorB.jsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Card, Typography, Flex } from 'antd';
|
||||
import { setValSvg } from '../../components/Global/MqttConnection';
|
||||
import SvgTemplate from './SvgTemplate';
|
||||
import SvgViewer from './SvgViewer';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
const filePathSvg = '/svg/test-new.svg';
|
||||
const topicMqtt = 'PIU_GGCP/Devices/PB';
|
||||
|
||||
const SvgCompressorB = () => {
|
||||
return (
|
||||
<SvgTemplate>
|
||||
<SvgViewer filePathSvg={filePathSvg} topicMqtt={topicMqtt} setValSvg={setValSvg} />
|
||||
</SvgTemplate>
|
||||
);
|
||||
};
|
||||
|
||||
export default SvgCompressorB;
|
||||
20
src/pages/home/SvgCompressorC.jsx
Normal file
20
src/pages/home/SvgCompressorC.jsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Card, Typography, Flex } from 'antd';
|
||||
import { setValSvg } from '../../components/Global/MqttConnection';
|
||||
import SvgTemplate from './SvgTemplate';
|
||||
import SvgViewer from './SvgViewer';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
const filePathSvg = '/svg/test-new.svg';
|
||||
const topicMqtt = 'PIU_GGCP/Devices/PB';
|
||||
|
||||
const SvgCompressorC = () => {
|
||||
return (
|
||||
<SvgTemplate>
|
||||
<SvgViewer filePathSvg={filePathSvg} topicMqtt={topicMqtt} setValSvg={setValSvg} />
|
||||
</SvgTemplate>
|
||||
);
|
||||
};
|
||||
|
||||
export default SvgCompressorC;
|
||||
20
src/pages/home/SvgOverview.jsx
Normal file
20
src/pages/home/SvgOverview.jsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Card, Typography, Flex } from 'antd';
|
||||
import { setValSvg } from '../../components/Global/MqttConnection';
|
||||
import SvgTemplate from './SvgTemplate';
|
||||
import SvgViewer from './SvgViewer';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
const filePathSvg = '/svg/test-new.svg';
|
||||
const topicMqtt = 'PIU_GGCP/Devices/PB';
|
||||
|
||||
const SvgOverview = () => {
|
||||
return (
|
||||
<SvgTemplate>
|
||||
<SvgViewer filePathSvg={filePathSvg} topicMqtt={topicMqtt} setValSvg={setValSvg} />
|
||||
</SvgTemplate>
|
||||
);
|
||||
};
|
||||
|
||||
export default SvgOverview;
|
||||
19
src/pages/home/SvgTemplate.jsx
Normal file
19
src/pages/home/SvgTemplate.jsx
Normal file
@@ -0,0 +1,19 @@
|
||||
const SvgTemplate = ({ children }) => {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
height: '80vh', // penuh 1 layar
|
||||
width: '80vw', // penuh 1 layar lebar
|
||||
overflow: 'hidden', // hilangkan scroll
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
backgroundColor: '#fff', // opsional
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default SvgTemplate;
|
||||
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react';
|
||||
import { Card, Typography, Flex } from 'antd';
|
||||
// import { ReactSVG } from 'react-svg';
|
||||
import { setValSvg } from '../../components/Global/MqttConnection';
|
||||
import { ReactSVG } from 'react-svg';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
|
||||
19
src/pages/home/SvgViewer.jsx
Normal file
19
src/pages/home/SvgViewer.jsx
Normal file
@@ -0,0 +1,19 @@
|
||||
// SvgViewer.jsx
|
||||
import { ReactSVG } from 'react-svg';
|
||||
|
||||
const SvgViewer = ({ filePathSvg, topicMqtt, setValSvg }) => {
|
||||
return (
|
||||
<ReactSVG
|
||||
src={filePathSvg}
|
||||
beforeInjection={(svg) => {
|
||||
svg.setAttribute('width', '100%');
|
||||
svg.setAttribute('height', '100%');
|
||||
svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');
|
||||
if (setValSvg) setValSvg(topicMqtt, svg);
|
||||
}}
|
||||
style={{ width: '100%', height: '100%' }}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default SvgViewer;
|
||||
Reference in New Issue
Block a user