Add font size setting to dial
This commit is contained in:
parent
e6438ad0f1
commit
f4d350e5eb
|
|
@ -1,4 +1,5 @@
|
||||||
import { SensorInfo } from '@/api/sensors'
|
import { SensorInfo } from '@/api/sensors'
|
||||||
|
import { FormField } from '@/components/FormField'
|
||||||
import { DashboardDialData } from '@/utils/dashboard/parseDashboard'
|
import { DashboardDialData } from '@/utils/dashboard/parseDashboard'
|
||||||
import { useForm } from '@/utils/hooks/useForm'
|
import { useForm } from '@/utils/hooks/useForm'
|
||||||
import { omit } from '@/utils/omit'
|
import { omit } from '@/utils/omit'
|
||||||
|
|
@ -41,6 +42,17 @@ export const DialSettings = ({ sensors, value, onChange }: Props) => {
|
||||||
<label>Multiplier</label>
|
<label>Multiplier</label>
|
||||||
<input type="number" step="any" {...register('multiplier')} />
|
<input type="number" step="any" {...register('multiplier')} />
|
||||||
</div>
|
</div>
|
||||||
|
<FormField
|
||||||
|
name="fontSIze"
|
||||||
|
label="Font size"
|
||||||
|
hint="Font size multiplier, default 1"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
step="any"
|
||||||
|
{...register('fontSize', { type: 'number' })}
|
||||||
|
/>
|
||||||
|
</FormField>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,14 @@ export const BoxDialContent = ({ data, ...editableBoxProps }: Props) => {
|
||||||
{showFetchLoading && <BoxLoader />}
|
{showFetchLoading && <BoxLoader />}
|
||||||
<div className="dial">
|
<div className="dial">
|
||||||
{value.data && (
|
{value.data && (
|
||||||
<>
|
<div
|
||||||
|
style={{
|
||||||
|
...(data.fontSize && { fontSize: `${data.fontSize * 100}%` }),
|
||||||
|
}}
|
||||||
|
>
|
||||||
{displayValue}
|
{displayValue}
|
||||||
{data.unit && ` ${data.unit}`}
|
{data.unit && ` ${data.unit}`}
|
||||||
</>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ export type DashboardDialData = {
|
||||||
unit?: string
|
unit?: string
|
||||||
decimals?: string
|
decimals?: string
|
||||||
multiplier?: string
|
multiplier?: string
|
||||||
|
fontSize?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export const parseDashboard = (input: string) => {
|
export const parseDashboard = (input: string) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue