|
@ -1,5 +1,6 @@ |
|
|
import icon_bluetooth from '../assets/icon_bluetooth.svg'; |
|
|
import icon_bluetooth from '../assets/icon_bluetooth.svg'; |
|
|
import icon_arr_d from '../assets/icon_arr_down.svg'; |
|
|
import icon_arr_d from '../assets/icon_arr_down.svg'; |
|
|
|
|
|
import power_icon from '../assets/power.svg'; |
|
|
import './CustomNavBar.scss'; |
|
|
import './CustomNavBar.scss'; |
|
|
import { useState } from 'react'; |
|
|
import { useState } from 'react'; |
|
|
import { useAppSelector } from '../utils/hooks'; |
|
|
import { useAppSelector } from '../utils/hooks'; |
|
@ -26,22 +27,28 @@ export default function CustomNavBar({ title }: { title: string }) { |
|
|
<h1 className="text-lg text-text ml-3">{title}</h1> |
|
|
<h1 className="text-lg text-text ml-3">{title}</h1> |
|
|
{/** 蓝牙连接状态 */} |
|
|
{/** 蓝牙连接状态 */} |
|
|
{device.connected ? ( |
|
|
{device.connected ? ( |
|
|
<div |
|
|
|
|
|
className="ml-auto flex items-center cursor-pointer" |
|
|
|
|
|
onClick={() => setShowDetail(!showDetail)} |
|
|
|
|
|
> |
|
|
|
|
|
<div className="bluetooth-battery flex justify-center items-center">{device.power}%</div> |
|
|
|
|
|
<img src={icon_bluetooth} alt="icon" className="mx-2" /> |
|
|
|
|
|
<span>设备已连接</span> |
|
|
|
|
|
<img |
|
|
|
|
|
src={icon_arr_d} |
|
|
|
|
|
alt="arr" |
|
|
|
|
|
style={{ |
|
|
|
|
|
transform: device.connected && showDetail ? 'rotate(180deg)' : 'rotate(0deg)', |
|
|
|
|
|
transition: 'transform 300ms', |
|
|
|
|
|
}} |
|
|
|
|
|
/> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<div |
|
|
|
|
|
className="ml-auto flex items-center cursor-pointer" |
|
|
|
|
|
onClick={() => setShowDetail(!showDetail)} |
|
|
|
|
|
> |
|
|
|
|
|
<img src={icon_bluetooth} alt="icon" className="mx-2" /> |
|
|
|
|
|
<span>设备已连接</span> |
|
|
|
|
|
<img |
|
|
|
|
|
src={icon_arr_d} |
|
|
|
|
|
alt="arr" |
|
|
|
|
|
style={{ |
|
|
|
|
|
transform: device.connected && showDetail ? 'rotate(180deg)' : 'rotate(0deg)', |
|
|
|
|
|
transition: 'transform 300ms', |
|
|
|
|
|
}} |
|
|
|
|
|
/> |
|
|
|
|
|
<div className="bluetooth-battery"> |
|
|
|
|
|
<div className="bg-color" style={{ width: `${device.power}%`, backgroundColor: device.flag ? '#1dbb1d' : device.power > 20 ? '#3e63cb' : 'red' }}></div> |
|
|
|
|
|
<div className={'power-head'} style={{ backgroundColor: device.flag ? '#1dbb1d' : device.power > 20 ? '#3e63cb' : 'red' }}></div> |
|
|
|
|
|
<span className="power-num">{device.power}</span> |
|
|
|
|
|
{device.flag === 1 && <img src={power_icon} alt=""/>} |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
) : ( |
|
|
) : ( |
|
|
<div |
|
|
<div |
|
|
className="ml-auto flex items-center cursor-pointer" |
|
|
className="ml-auto flex items-center cursor-pointer" |
|
|