| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- /* Devices 页面样式:极简风格,响应式设计 */
- /* 主容器 */
- .Devices-container {
- width: 100%;
- height: 100%;
- display: flex;
- box-sizing: border-box;
- flex-direction: column;
- align-items: flex-start;
- background: #f8f9fa;
- /* padding: clamp(0.75rem, 2vw, 1.5rem); */
- }
- /* 头部区域 */
- .devices-header {
- width: 100%;
- display: grid;
- grid-template-columns: 1fr auto;
- align-items: center;
- gap: clamp(0.5rem, 1.5vw, 1rem);
- box-sizing: border-box;
- border: 1px solid #e5e7eb;
- border-radius: clamp(6px, 1vw, 8px);
- background: #ffffff;
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
- container-type: inline-size; /* enable cqw-based scaling */
- padding: clamp(0.5rem, 1.5vw, 1rem);
- }
- /* 标题 */
- .devices-title {
- width: 100%; /* takes its 60% grid column */
- display: flex;
- box-sizing: border-box;
- align-items: center;
- font-size: clamp(1rem, 6cqw, 1.9rem);
- font-weight: 600;
- color: #1a1a1a;
- letter-spacing: -0.5px;
- line-height: 1.2;
- white-space: nowrap;
- }
- /* 刷新按钮 */
- .refresh-btn {
- justify-self: end;
- inline-size: min(100%, clamp(70px, 28cqw, 120px)); /* scale by header width */
- max-inline-size: 100%;
- min-inline-size: 0;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: clamp(0.12rem, 1.2cqw, 0.35rem);
- min-height: clamp(30px, 7cqw, 36px);
- padding: clamp(0.26rem, 1.1cqw, 0.42rem) clamp(0.42rem, 1.8cqw, 0.82rem); /* shrink padding as header narrows */
- background: #1a1a1a;
- color: white;
- border: none;
- border-radius: clamp(6px, 1cqw, 8px);
- cursor: pointer;
- font-size: clamp(0.48rem, 2.2cqw, 0.82rem); /* text scales with container */
- font-weight: 500;
- transition: all 0.2s ease;
- line-height: 1.1;
- user-select: none;
- white-space: nowrap;
- flex-shrink: 1;
- box-sizing: border-box;
- overflow: hidden; /* ensure it never spills outside the header */
- }
- .refresh-btn:hover:not(.disabled) {
- background: #333;
- transform: translateY(-1px);
- }
- .refresh-btn:active:not(.disabled) {
- transform: translateY(0);
- }
- .refresh-btn.disabled {
- opacity: 1;
- cursor: not-allowed;
- background: #e5e7eb; /* clearer contrast for loading state */
- color: #374151;
- }
- .refresh-btn.disabled:hover {
- transform: none;
- background: #e5e7eb;
- }
- /* 刷新图标 */
- .refresh-icon {
- font-size: 1em; /* inherit current button size */
- transition: transform 0.3s ease;
- display: inline-block;
- }
- /* 悬停时图标旋转 */
- .refresh-btn:hover .refresh-icon:not(.spinning) {
- transform: rotate(180deg);
- }
- /* 扫描中图标持续旋转 */
- .refresh-icon.spinning {
- animation: spin 1s linear infinite;
- }
- /* 旋转动画 */
- @keyframes spin {
- from {
- transform: rotate(0deg);
- }
- to {
- transform: rotate(360deg);
- }
- }
- /* 滚动区域 */
- .devices-scroll-area {
- flex: 1;
- overflow-y: auto;
- overflow-x: hidden;
- padding: 0;
- width: 100%;
- box-sizing: border-box;
- }
- /* 自定义滚动条 */
- .devices-scroll-area::-webkit-scrollbar {
- width: 6px;
- }
- .devices-scroll-area::-webkit-scrollbar-track {
- background: transparent;
- }
- .devices-scroll-area::-webkit-scrollbar-thumb {
- background: #d1d5db;
- border-radius: 3px;
- }
- .devices-scroll-area::-webkit-scrollbar-thumb:hover {
- background: #9ca3af;
- }
- /* 设备项 */
- .device-item {
- display: grid;
- grid-template-columns: 1fr auto; /* text flexes, button keeps size */
- align-items: center;
- width: 100%; /* align with header width */
- box-sizing: border-box;
- column-gap: clamp(0.25rem, 0.8vw, 0.6rem);
- padding: clamp(0.6rem, 1.2vw, 0.85rem) clamp(0.75rem, 1.6vw, 1rem);
- margin-bottom: clamp(0.5rem, 1.5vw, 0.75rem);
- background: white;
- border-radius: clamp(6px, 1vw, 8px);
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
- transition: all 0.2s ease;
- border: 1px solid #e5e7eb;
- container-type: inline-size; /* allow cqw-based scaling inside */
- }
- .device-item:hover {
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
- border-color: #d1d5db;
- transform: translateY(-1px);
- }
- .device-actions {
- display: flex;
- flex-direction: column;
- gap: clamp(0.4rem, 1vw, 0.75rem);
- align-items: flex-start;
- }
- .action-row {
- display: flex;
- flex-direction: column;
- gap: clamp(0.4rem, 1vw, 0.75rem);
- align-items: flex-end;
- }
- /* 设备信息容器 */
- .device-info {
- width: 100%;
- min-width: 0;
- }
- /* 设备 ID(IP:端口) */
- .device-id {
- /* scale with device-item width */
- width: 100%;
- font-size: clamp(0.45rem, 2.4cqw, 0.85rem);
- font-weight: 500;
- color: #1a1a1a;
- font-family: 'Courier New', 'Consolas', monospace;
- overflow-wrap: anywhere;
- word-break: break-all;
- white-space: normal;
- letter-spacing: 0;
- line-height: 1.35;
- }
- /* 连接按钮 */
- .connect-btn {
- /* scale with device-item width */
- width: auto;
- padding: clamp(0.32rem, 0.9cqw, 0.5rem) clamp(0.5rem, 1.3cqw, 0.85rem);
- background: #1a1a1a;
- color: white;
- border: none;
- border-radius: clamp(6px, 1vw, 8px);
- cursor: pointer;
- font-size: clamp(0.65rem, 1.6cqw, 0.85rem);
- font-weight: 500;
- transition: all 0.2s ease;
- white-space: nowrap;
- margin-left: clamp(0.25rem, 1vw, 0.75rem);
- user-select: none;
- flex-shrink: 0;
- }
- .connect-btn:hover:not(.disabled) {
- background: #333;
- transform: translateY(-1px);
- }
- .connect-btn:active:not(.disabled) {
- transform: translateY(0);
- }
- .connect-btn.disabled {
- opacity: 0.4;
- cursor: not-allowed;
- background: #ccc;
- }
- .connect-btn.disabled:hover {
- transform: none;
- }
- /* 断开按钮 */
- .disconnect-btn {
- /* match connect button sizing */
- padding: clamp(0.32rem, 0.9cqw, 0.5rem) clamp(0.5rem, 1.3cqw, 0.85rem);
- background: #dc2626;
- color: white;
- border: none;
- border-radius: clamp(6px, 1vw, 8px);
- cursor: pointer;
- font-size: clamp(0.65rem, 1.6cqw, 0.85rem);
- font-weight: 500;
- transition: all 0.2s ease;
- white-space: nowrap;
- user-select: none;
- flex-shrink: 0;
- }
- .disconnect-btn:hover:not(.disabled) {
- background: #b91c1c;
- transform: translateY(-1px);
- }
- .disconnect-btn:active:not(.disabled) {
- transform: translateY(0);
- }
- .disconnect-btn.disabled {
- opacity: 0.4;
- cursor: not-allowed;
- background: #ccc;
- }
- .disconnect-btn.disabled:hover {
- transform: none;
- }
- /* 预览按钮 */
- .preview-btn {
- padding: clamp(0.32rem, 0.9cqw, 0.5rem) clamp(0.5rem, 1.3cqw, 0.85rem);
- background: #2abf6e;
- color: white;
- border: none;
- border-radius: clamp(6px, 1vw, 8px);
- cursor: pointer;
- font-size: clamp(0.65rem, 1.6cqw, 0.85rem);
- font-weight: 500;
- transition: all 0.2s ease;
- white-space: nowrap;
- user-select: none;
- flex-shrink: 0;
- }
- .preview-btn.disabled {
- opacity: 0.4;
- cursor: not-allowed;
- background: #ccc;
- }
- .preview-btn--active {
- background: #4a90e2;
- color: #fff;
- }
- /* 平板适配 */
- @media (min-width: 768px) and (max-width: 1023px) {
- .devices-header {
- padding: clamp(0.75rem, 1.5vw, 1rem);
- }
- }
- /* 移动端适配 */
- @media (max-width: 767px) {
- .Devices-container {
- padding: clamp(0.5rem, 2vw, 1rem);
- }
-
- .devices-header {
- flex-direction: column;
- align-items: flex-start;
- gap: clamp(0.5rem, 1.5vw, 0.75rem);
- padding: clamp(0.75rem, 2vw, 1rem);
- }
-
- .refresh-btn {
- width: 100%;
- justify-content: center;
- }
-
- .device-item {
- flex-direction: column;
- align-items: flex-start;
- gap: clamp(0.5rem, 1.5vw, 0.75rem);
- }
-
- .connect-btn {
- width: 100%;
- margin-left: 0;
- }
- }
|