99 lines
2.5 KiB
TypeScript
99 lines
2.5 KiB
TypeScript
'use client'
|
|
|
|
// Next Imports
|
|
import dynamic from 'next/dynamic'
|
|
|
|
// MUI Imports
|
|
import Card from '@mui/material/Card'
|
|
import Typography from '@mui/material/Typography'
|
|
import CardContent from '@mui/material/CardContent'
|
|
import CardHeader from '@mui/material/CardHeader'
|
|
import { useTheme } from '@mui/material/styles'
|
|
|
|
// Third-party Imports
|
|
import type { ApexOptions } from 'apexcharts'
|
|
|
|
// Component Imports
|
|
import OptionMenu from '@core/components/option-menu'
|
|
|
|
// Styled Component Imports
|
|
const AppReactApexCharts = dynamic(() => import('@/libs/styles/AppReactApexCharts'))
|
|
|
|
// Vars - Mock weather data (temp variation through day)
|
|
const series = [{ data: [18, 22, 26, 28, 25, 20, 18] }]
|
|
|
|
const FarmWeatherCard = () => {
|
|
const theme = useTheme()
|
|
const infoColor = theme.palette.info.main
|
|
|
|
const options: ApexOptions = {
|
|
chart: {
|
|
parentHeightOffset: 0,
|
|
toolbar: { show: false },
|
|
sparkline: { enabled: true }
|
|
},
|
|
tooltip: { enabled: false },
|
|
dataLabels: { enabled: false },
|
|
stroke: {
|
|
width: 2,
|
|
curve: 'smooth'
|
|
},
|
|
grid: {
|
|
show: false,
|
|
padding: { bottom: 20 }
|
|
},
|
|
fill: {
|
|
type: 'gradient',
|
|
gradient: {
|
|
opacityTo: 0,
|
|
opacityFrom: 1,
|
|
shadeIntensity: 1,
|
|
stops: [0, 100],
|
|
colorStops: [
|
|
[
|
|
{ offset: 0, opacity: 0.4, color: infoColor },
|
|
{ opacity: 0, offset: 100, color: 'var(--mui-palette-background-paper)' }
|
|
]
|
|
]
|
|
}
|
|
},
|
|
theme: {
|
|
monochrome: {
|
|
enabled: true,
|
|
shadeTo: 'light',
|
|
shadeIntensity: 1,
|
|
color: infoColor
|
|
}
|
|
},
|
|
xaxis: {
|
|
labels: { show: false },
|
|
axisTicks: { show: false },
|
|
axisBorder: { show: false }
|
|
},
|
|
yaxis: { show: false }
|
|
}
|
|
|
|
return (
|
|
<Card className='pbe-6'>
|
|
<CardHeader
|
|
title='Weather Today'
|
|
subheader='Clear, 24°C'
|
|
className='pbe-3'
|
|
action={<OptionMenu options={['Refresh', '7-day forecast', 'Details']} />}
|
|
/>
|
|
<CardContent>
|
|
<div className='flex items-center gap-2 mbe-2'>
|
|
<i className='tabler-sun text-4xl text-warning' />
|
|
<Typography variant='h4'>24°C</Typography>
|
|
<Typography color='text.disabled' variant='body2'>
|
|
Humid: 45% | Wind: 12 km/h
|
|
</Typography>
|
|
</div>
|
|
</CardContent>
|
|
<AppReactApexCharts type='area' height={88} width='100%' series={series} options={options} />
|
|
</Card>
|
|
)
|
|
}
|
|
|
|
export default FarmWeatherCard
|