myroom-react
Version:
React component wrapper for MyRoom 3D scene
583 lines (581 loc) • 10.4 kB
CSS
/* src/components/MyRoomScene.css */
.myroom-scene {
position: relative;
display: block;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
overflow: hidden;
background:
linear-gradient(
135deg,
#1e3c72 0%,
#2a5298 100%);
}
.myroom-scene canvas {
display: block;
width: 100%;
height: 100%;
outline: none;
touch-action: none;
border-radius: 8px;
}
.myroom-loading {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 16px;
color: white;
font-family:
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
sans-serif;
font-size: 16px;
z-index: 1000;
text-align: center;
}
.loading-spinner {
width: 40px;
height: 40px;
border: 3px solid rgba(255, 255, 255, 0.3);
border-top: 3px solid white;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.myroom-loading p {
margin: 0;
font-weight: 500;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.myroom-error {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
color: #ff6b6b;
font-family:
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
sans-serif;
font-size: 14px;
text-align: center;
z-index: 1000;
background: rgba(0, 0, 0, 0.9);
padding: 24px;
border-radius: 12px;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 107, 107, 0.3);
max-width: 300px;
}
.error-icon {
font-size: 24px;
margin-bottom: 8px;
}
.myroom-error p {
margin: 0;
line-height: 1.4;
font-weight: 500;
}
.myroom-controls {
position: absolute;
top: 16px;
right: 16px;
z-index: 1000;
display: flex;
gap: 8px;
flex-direction: column;
}
.control-btn {
background: rgba(255, 255, 255, 0.9);
border: none;
border-radius: 8px;
padding: 12px;
cursor: pointer;
font-size: 16px;
transition: all 0.2s ease;
backdrop-filter: blur(10px);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
min-width: 44px;
min-height: 44px;
display: flex;
align-items: center;
justify-content: center;
}
.control-btn:hover {
background: rgba(255, 255, 255, 1);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.control-btn:active {
transform: translateY(0);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.integrated-babylon-scene-placeholder {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: rgba(0, 0, 0, 0.8);
color: white;
font-family:
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
sans-serif;
text-align: center;
padding: 20px;
z-index: 500;
}
.integrated-babylon-scene-placeholder p {
margin: 8px 0;
font-size: 14px;
opacity: 0.8;
}
@media (max-width: 768px) {
.myroom-controls {
top: 12px;
right: 12px;
}
.control-btn {
padding: 10px;
font-size: 14px;
min-width: 40px;
min-height: 40px;
}
.myroom-loading {
font-size: 14px;
}
.loading-spinner {
width: 32px;
height: 32px;
}
}
@media (max-width: 480px) {
.myroom-controls {
top: 8px;
right: 8px;
}
.control-btn {
padding: 8px;
font-size: 12px;
min-width: 36px;
min-height: 36px;
}
}
@media (prefers-color-scheme: dark) {
.myroom-scene {
background:
linear-gradient(
135deg,
#0f1419 0%,
#1a2332 100%);
}
.control-btn {
background: rgba(255, 255, 255, 0.1);
color: white;
}
.control-btn:hover {
background: rgba(255, 255, 255, 0.2);
}
}
@media (prefers-contrast: high) {
.myroom-scene {
border: 2px solid #000;
}
.control-btn {
border: 2px solid #000;
background: white;
color: black;
}
.myroom-loading,
.myroom-error {
background: white;
color: black;
border: 2px solid #000;
}
}
/* src/demo/MyRoomDemo.css */
.myroom-demo {
max-width: 1400px;
margin: 0 auto;
padding: 20px;
font-family:
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
sans-serif;
background:
linear-gradient(
135deg,
#667eea 0%,
#764ba2 100%);
min-height: 100vh;
}
.demo-header {
text-align: center;
color: white;
margin-bottom: 30px;
}
.demo-header h1 {
font-size: 2.5rem;
margin-bottom: 10px;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.demo-header p {
font-size: 1.1rem;
opacity: 0.9;
}
.demo-content {
display: grid;
grid-template-columns: 350px 1fr;
gap: 20px;
margin-bottom: 20px;
}
.controls-panel {
background: white;
border-radius: 12px;
padding: 24px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
height: fit-content;
max-height: 800px;
overflow-y: auto;
}
.control-section {
margin-bottom: 24px;
}
.control-section:last-child {
margin-bottom: 0;
}
.control-section h3 {
color: #333;
margin-bottom: 12px;
font-size: 1.1rem;
font-weight: 600;
}
.control-section h4 {
color: #555;
margin-bottom: 8px;
font-size: 0.9rem;
font-weight: 500;
}
.room-buttons {
display: flex;
flex-direction: column;
gap: 8px;
}
.room-btn {
background: #f8f9fa;
border: 2px solid #e9ecef;
border-radius: 8px;
padding: 12px 16px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: all 0.2s ease;
text-align: left;
}
.room-btn:hover {
background: #e9ecef;
border-color: #dee2e6;
}
.room-btn.active {
background: #007bff;
border-color: #007bff;
color: white;
}
.gender-buttons {
display: flex;
gap: 8px;
}
.gender-btn {
flex: 1;
background: #f8f9fa;
border: 2px solid #e9ecef;
border-radius: 8px;
padding: 12px 16px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: all 0.2s ease;
}
.gender-btn:hover {
background: #e9ecef;
border-color: #dee2e6;
}
.gender-btn.active {
background: #28a745;
border-color: #28a745;
color: white;
}
.item-controls {
display: flex;
gap: 8px;
margin-bottom: 16px;
}
.item-controls select {
flex: 1;
padding: 8px 12px;
border: 2px solid #e9ecef;
border-radius: 6px;
font-size: 14px;
background: white;
}
.add-item-btn {
background: #28a745;
border: none;
border-radius: 6px;
padding: 8px 16px;
color: white;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: background 0.2s ease;
}
.add-item-btn:hover {
background: #218838;
}
.item-list {
background: #f8f9fa;
border-radius: 8px;
padding: 16px;
}
.item-entry {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 0;
border-bottom: 1px solid #e9ecef;
}
.item-entry:last-child {
border-bottom: none;
}
.item-entry span {
font-size: 14px;
color: #333;
}
.remove-item-btn {
background: #dc3545;
border: none;
border-radius: 4px;
color: white;
cursor: pointer;
font-size: 16px;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.2s ease;
}
.remove-item-btn:hover {
background: #c82333;
}
.clear-all-btn {
background: #6c757d;
border: none;
border-radius: 6px;
padding: 8px 16px;
color: white;
cursor: pointer;
font-size: 14px;
font-weight: 500;
margin-top: 12px;
width: 100%;
transition: background 0.2s ease;
}
.clear-all-btn:hover {
background: #5a6268;
}
.gizmo-buttons {
display: flex;
gap: 8px;
}
.gizmo-btn {
flex: 1;
background: #f8f9fa;
border: 2px solid #e9ecef;
border-radius: 8px;
padding: 10px 12px;
cursor: pointer;
font-size: 12px;
font-weight: 500;
transition: all 0.2s ease;
}
.gizmo-btn:hover {
background: #e9ecef;
border-color: #dee2e6;
}
.gizmo-btn.active {
background: #ffc107;
border-color: #ffc107;
color: #212529;
}
.action-buttons {
display: flex;
flex-direction: column;
gap: 8px;
}
.action-btn {
background: #007bff;
border: none;
border-radius: 8px;
padding: 12px 16px;
color: white;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: background 0.2s ease;
}
.action-btn:hover {
background: #0056b3;
}
.status-display {
background: #e7f3ff;
border: 1px solid #b3d9ff;
border-radius: 8px;
padding: 12px;
}
.status-display p {
margin: 0;
font-size: 14px;
color: #0056b3;
font-weight: 500;
}
.scene-container {
background: white;
border-radius: 12px;
padding: 20px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
display: flex;
align-items: center;
justify-content: center;
}
.demo-scene {
border-radius: 8px;
overflow: hidden;
}
.demo-footer {
background: white;
border-radius: 12px;
padding: 20px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
text-align: center;
}
.demo-footer p {
margin: 0;
color: #666;
font-size: 14px;
}
@media (max-width: 1200px) {
.demo-content {
grid-template-columns: 300px 1fr;
}
}
@media (max-width: 768px) {
.demo-content {
grid-template-columns: 1fr;
gap: 16px;
}
.controls-panel {
order: 2;
max-height: none;
}
.scene-container {
order: 1;
}
.demo-header h1 {
font-size: 2rem;
}
.gender-buttons,
.gizmo-buttons {
flex-direction: column;
}
.item-controls {
flex-direction: column;
}
}
@media (max-width: 480px) {
.myroom-demo {
padding: 16px;
}
.controls-panel {
padding: 16px;
}
.scene-container {
padding: 16px;
}
.demo-header h1 {
font-size: 1.5rem;
}
}
@media (prefers-color-scheme: dark) {
.controls-panel,
.scene-container,
.demo-footer {
background: #2d3748;
color: white;
}
.control-section h3,
.control-section h4 {
color: #e2e8f0;
}
.room-btn,
.gender-btn,
.gizmo-btn {
background: #4a5568;
border-color: #718096;
color: #e2e8f0;
}
.room-btn:hover,
.gender-btn:hover,
.gizmo-btn:hover {
background: #718096;
}
.item-list {
background: #4a5568;
}
.item-entry {
border-bottom-color: #718096;
}
.item-entry span {
color: #e2e8f0;
}
.item-controls select {
background: #4a5568;
border-color: #718096;
color: #e2e8f0;
}
.status-display {
background: #2c5282;
border-color: #4299e1;
}
.status-display p {
color: #bee3f8;
}
}