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 { FormField } from '@/components/FormField'
|
||||
import { DashboardDialData } from '@/utils/dashboard/parseDashboard'
|
||||
import { useForm } from '@/utils/hooks/useForm'
|
||||
import { omit } from '@/utils/omit'
|
||||
|
|
@ -41,6 +42,17 @@ export const DialSettings = ({ sensors, value, onChange }: Props) => {
|
|||
<label>Multiplier</label>
|
||||
<input type="number" step="any" {...register('multiplier')} />
|
||||
</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 />}
|
||||
<div className="dial">
|
||||
{value.data && (
|
||||
<>
|
||||
<div
|
||||
style={{
|
||||
...(data.fontSize && { fontSize: `${data.fontSize * 100}%` }),
|
||||
}}
|
||||
>
|
||||
{displayValue}
|
||||
{data.unit && ` ${data.unit}`}
|
||||
</>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ export type DashboardDialData = {
|
|||
unit?: string
|
||||
decimals?: string
|
||||
multiplier?: string
|
||||
fontSize?: number
|
||||
}
|
||||
|
||||
export const parseDashboard = (input: string) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue