react-vnc-lib
Version:
A modern, lightweight VNC client library for React, Next.js, Node.js, and Bun with TypeScript support
287 lines (286 loc) • 5.38 kB
CSS
/* src/styles/VNCViewer.css */
.vnc-viewer {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
background-color: #1a1a1a;
color: #e0e0e0;
font-family:
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
Oxygen,
Ubuntu,
Cantarell,
sans-serif;
font-size: 14px;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.vnc-viewer--loading {
justify-content: center;
align-items: center;
}
.vnc-viewer--error {
justify-content: center;
align-items: center;
}
.vnc-viewer--connected {
}
.vnc-loading {
display: flex;
flex-direction: column;
align-items: center;
gap: 16px;
padding: 32px;
}
.vnc-loading__text {
font-size: 16px;
color: #00bcd4;
position: relative;
}
.vnc-loading__text::after {
content: "";
display: inline-block;
width: 20px;
height: 20px;
margin-left: 8px;
border: 2px solid #333;
border-top: 2px solid #00bcd4;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.vnc-error {
display: flex;
flex-direction: column;
align-items: center;
gap: 16px;
padding: 32px;
text-align: center;
}
.vnc-error__text {
font-size: 16px;
color: #f44336;
margin-bottom: 8px;
}
.vnc-error__button {
padding: 12px 24px;
background-color: #f44336;
color: white;
border: none;
border-radius: 6px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: background-color 0.2s ease;
}
.vnc-error__button:hover:not(:disabled) {
background-color: #d32f2f;
}
.vnc-error__button:disabled {
background-color: #666;
cursor: not-allowed;
}
.vnc-status {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 16px;
background-color: #2d2d2d;
border-bottom: 1px solid #404040;
min-height: 48px;
}
.vnc-status__info {
display: flex;
align-items: center;
gap: 8px;
}
.vnc-status__text {
font-size: 13px;
color: #e0e0e0;
}
.vnc-status__indicator {
font-weight: 600;
padding: 2px 8px;
border-radius: 12px;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.vnc-status__indicator--connected {
background-color: #4caf50;
color: white;
}
.vnc-status__indicator--disconnected {
background-color: #f44336;
color: white;
}
.vnc-status__server {
color: #00bcd4;
font-weight: 500;
}
.vnc-status__resolution {
color: #9e9e9e;
font-size: 12px;
}
.vnc-controls {
display: flex;
gap: 8px;
}
.vnc-controls__button {
padding: 8px 16px;
border: none;
border-radius: 6px;
font-size: 13px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
min-width: 80px;
}
.vnc-controls__button--connect {
background-color: #4caf50;
color: white;
}
.vnc-controls__button--connect:hover:not(:disabled) {
background-color: #45a049;
transform: translateY(-1px);
}
.vnc-controls__button--disconnect {
background-color: #f44336;
color: white;
}
.vnc-controls__button--disconnect:hover:not(:disabled) {
background-color: #d32f2f;
transform: translateY(-1px);
}
.vnc-controls__button:disabled {
background-color: #555;
color: #999;
cursor: not-allowed;
transform: none;
}
.vnc-canvas-container {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
background-color: #000;
position: relative;
overflow: auto;
padding: 8px;
}
.vnc-canvas {
outline: none;
cursor: crosshair;
border: 1px solid #333;
background: #000;
display: block;
max-width: 100%;
max-height: 100%;
border-radius: 4px;
transition: border-color 0.2s ease;
}
.vnc-canvas--focused {
border-color: #00bcd4;
box-shadow: 0 0 0 2px rgba(0, 188, 212, 0.2);
}
.vnc-cursor {
position: absolute;
top: 10px;
right: 10px;
width: 2px;
height: 16px;
background-color: #00ff00;
pointer-events: none;
z-index: 10;
border-radius: 1px;
transition: opacity 0.1s ease;
}
.vnc-cursor--visible {
opacity: 1;
}
.vnc-cursor--hidden {
opacity: 0;
}
@media (max-width: 768px) {
.vnc-status {
flex-direction: column;
gap: 8px;
padding: 8px 12px;
}
.vnc-status__info {
font-size: 12px;
}
.vnc-controls__button {
padding: 6px 12px;
font-size: 12px;
min-width: 70px;
}
.vnc-canvas-container {
padding: 4px;
}
}
.vnc-viewer {
--primary-color: #00bcd4;
--success-color: #4caf50;
--error-color: #f44336;
--warning-color: #ff9800;
--background-dark: #1a1a1a;
--background-medium: #2d2d2d;
--background-light: #404040;
--text-primary: #e0e0e0;
--text-secondary: #9e9e9e;
--border-color: #333;
}
.vnc-controls__button:focus,
.vnc-error__button:focus {
outline: 2px solid var(--primary-color);
outline-offset: 2px;
}
.vnc-canvas:focus {
}
@keyframes pulse {
0%, 100% {
opacity: 0.6;
}
50% {
opacity: 1;
}
}
.vnc-loading__text {
animation: pulse 2s ease-in-out infinite;
}
.vnc-viewer * {
box-sizing: border-box;
}
@media (prefers-contrast: high) {
.vnc-viewer {
border: 2px solid white;
}
.vnc-status {
border-bottom: 2px solid white;
}
.vnc-canvas {
border: 2px solid white;
}
}
@media (prefers-reduced-motion: reduce) {
.vnc-loading__text::after,
.vnc-loading__text,
.vnc-controls__button,
.vnc-canvas {
animation: none;
transition: none;
}
}