|
| 1 | +import React from "react"; |
| 2 | +import { createRoot } from "react-dom/client"; |
| 3 | +import ReactVisual from "../src/ReactVisual"; |
| 4 | +import LazyVideo from "../src/LazyVideo"; |
| 5 | +import VisualWrapper from "../src/VisualWrapper"; |
| 6 | + |
| 7 | +function App() { |
| 8 | + return ( |
| 9 | + <div className="container"> |
| 10 | + <h1>@react-visual/react Demo</h1> |
| 11 | + <p className="subtitle"> |
| 12 | + Interactive examples of the ReactVisual component library |
| 13 | + </p> |
| 14 | + |
| 15 | + {/* ReactVisual with Image */} |
| 16 | + <div className="demo-section"> |
| 17 | + <h2>ReactVisual - Image Examples</h2> |
| 18 | + <div className="demo-grid"> |
| 19 | + <div className="demo-item"> |
| 20 | + <h3> |
| 21 | + Basic Image with <code>aspect</code> |
| 22 | + </h3> |
| 23 | + <div className="visual-container"> |
| 24 | + <ReactVisual |
| 25 | + image="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=800" |
| 26 | + aspect={16 / 9} |
| 27 | + alt="Mountain landscape" |
| 28 | + /> |
| 29 | + </div> |
| 30 | + </div> |
| 31 | + |
| 32 | + <div className="demo-item"> |
| 33 | + <h3> |
| 34 | + Image with <code>fit="contain"</code> |
| 35 | + </h3> |
| 36 | + <div className="visual-container"> |
| 37 | + <ReactVisual |
| 38 | + image="https://images.unsplash.com/photo-1511884642898-4c92249e20b6?w=800" |
| 39 | + aspect={1} |
| 40 | + fit="contain" |
| 41 | + alt="Dog portrait" |
| 42 | + /> |
| 43 | + </div> |
| 44 | + </div> |
| 45 | + |
| 46 | + <div className="demo-item"> |
| 47 | + <h3>Image with explicit dimensions</h3> |
| 48 | + <div className="visual-container"> |
| 49 | + <ReactVisual |
| 50 | + image="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=800" |
| 51 | + width={400} |
| 52 | + height={300} |
| 53 | + alt="Forest" |
| 54 | + /> |
| 55 | + </div> |
| 56 | + </div> |
| 57 | + </div> |
| 58 | + </div> |
| 59 | + |
| 60 | + {/* ReactVisual with Video */} |
| 61 | + <div className="demo-section"> |
| 62 | + <h2>ReactVisual - Video with Poster</h2> |
| 63 | + <div className="demo-grid"> |
| 64 | + <div className="demo-item"> |
| 65 | + <h3>Video with Image Poster</h3> |
| 66 | + <div className="visual-container"> |
| 67 | + <ReactVisual |
| 68 | + video="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4" |
| 69 | + image="https://images.unsplash.com/photo-1492144534655-ae79c964c9d7?w=800" |
| 70 | + aspect={16 / 9} |
| 71 | + alt="Video with poster" |
| 72 | + /> |
| 73 | + </div> |
| 74 | + </div> |
| 75 | + |
| 76 | + <div className="demo-item"> |
| 77 | + <h3>Video without Poster</h3> |
| 78 | + <div className="visual-container"> |
| 79 | + <ReactVisual |
| 80 | + video="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4" |
| 81 | + aspect={16 / 9} |
| 82 | + noPoster |
| 83 | + alt="Video without poster" |
| 84 | + /> |
| 85 | + </div> |
| 86 | + </div> |
| 87 | + </div> |
| 88 | + </div> |
| 89 | + |
| 90 | + {/* VisualWrapper */} |
| 91 | + <div className="demo-section"> |
| 92 | + <h2>VisualWrapper - Layout Container</h2> |
| 93 | + <div className="demo-grid"> |
| 94 | + <div className="demo-item"> |
| 95 | + <h3>Custom Content in Wrapper</h3> |
| 96 | + <VisualWrapper aspect={16 / 9}> |
| 97 | + <div |
| 98 | + style={{ |
| 99 | + width: "100%", |
| 100 | + height: "100%", |
| 101 | + background: |
| 102 | + "linear-gradient(135deg, #667eea 0%, #764ba2 100%)", |
| 103 | + display: "flex", |
| 104 | + alignItems: "center", |
| 105 | + justifyContent: "center", |
| 106 | + color: "white", |
| 107 | + fontSize: "24px", |
| 108 | + fontWeight: "bold", |
| 109 | + }} |
| 110 | + > |
| 111 | + Custom Content |
| 112 | + </div> |
| 113 | + </VisualWrapper> |
| 114 | + </div> |
| 115 | + |
| 116 | + <div className="demo-item"> |
| 117 | + <h3>Square Aspect Ratio</h3> |
| 118 | + <VisualWrapper aspect={1}> |
| 119 | + <div |
| 120 | + style={{ |
| 121 | + width: "100%", |
| 122 | + height: "100%", |
| 123 | + background: |
| 124 | + "linear-gradient(135deg, #f093fb 0%, #f5576c 100%)", |
| 125 | + display: "flex", |
| 126 | + alignItems: "center", |
| 127 | + justifyContent: "center", |
| 128 | + color: "white", |
| 129 | + fontSize: "20px", |
| 130 | + }} |
| 131 | + > |
| 132 | + 1:1 |
| 133 | + </div> |
| 134 | + </VisualWrapper> |
| 135 | + </div> |
| 136 | + </div> |
| 137 | + </div> |
| 138 | + |
| 139 | + {/* Props Examples */} |
| 140 | + <div className="demo-section"> |
| 141 | + <h2>Advanced Props Examples</h2> |
| 142 | + <div className="demo-grid"> |
| 143 | + <div className="demo-item"> |
| 144 | + <h3> |
| 145 | + With <code>expand</code> prop |
| 146 | + </h3> |
| 147 | + <div style={{ position: "relative", height: "200px" }}> |
| 148 | + <ReactVisual |
| 149 | + image="https://images.unsplash.com/photo-1519681393784-d120267933ba?w=800" |
| 150 | + expand |
| 151 | + alt="Stars" |
| 152 | + /> |
| 153 | + </div> |
| 154 | + </div> |
| 155 | + |
| 156 | + <div className="demo-item"> |
| 157 | + <h3> |
| 158 | + With <code>className</code> and <code>style</code> |
| 159 | + </h3> |
| 160 | + <div className="visual-container"> |
| 161 | + <ReactVisual |
| 162 | + image="https://images.unsplash.com/photo-1469474968028-56623f02e42e?w=800" |
| 163 | + aspect={16 / 9} |
| 164 | + className="custom-class" |
| 165 | + style={{ border: "4px solid #667eea", borderRadius: "8px" }} |
| 166 | + alt="Nature" |
| 167 | + /> |
| 168 | + </div> |
| 169 | + </div> |
| 170 | + </div> |
| 171 | + </div> |
| 172 | + </div> |
| 173 | + ); |
| 174 | +} |
| 175 | + |
| 176 | +const root = createRoot(document.getElementById("root")!); |
| 177 | +root.render(<App />); |
0 commit comments