Spaces:
Running
Running
Download components/material-selector.js from alexartie/pixelforge-studio: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/spaces/alexartie/pixelforge-studio/resolve/main/components/material-selector.js
- Command line
-
hf download hf://spaces/alexartie/pixelforge-studio/components/material-selector.js
-
curl -L -o material-selector.js https://huggingface.co/spaces/alexartie/pixelforge-studio/resolve/main/components/material-selector.js
1.22 kB
| class MaterialSelector extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| .material-selector { | |
| display: flex; | |
| gap: 0.5rem; | |
| margin: 1rem 0; | |
| } | |
| .material-btn { | |
| padding: 0.5rem 1rem; | |
| border-radius: 0.5rem; | |
| border: none; | |
| cursor: pointer; | |
| transition: all 0.2s; | |
| font-weight: 600; | |
| } | |
| .material-btn.active { | |
| transform: translateY(-2px); | |
| box-shadow: 0 4px 6px rgba(0,0,0,0.1); | |
| } | |
| </style> | |
| <div class="material-selector"> | |
| <button class="material-btn" data-material="sand" style="background: #c2b280">Sand</button> | |
| <button class="material-btn" data-material="water" style="background: #ffffff; color: #333; border: 1px solid #e0f2fe">Water</button> | |
| <button class="material-btn" data-material="oil" style="background: #FFD700">Oil</button> | |
| <button class="material-btn" data-material="snow" style="background: #ffffff; color: #333; border: 1px solid #f0f9ff">Snow</button> | |
| </div> | |
| `; | |
| } | |
| } | |
| customElements.define('material-selector', MaterialSelector); |