Skip to content

Commit 3dfc0b8

Browse files
committed
feat(examples): add cyberpunk theme styling
- Replace basic styles with cyberpunk-themed CSS matching react-grid-layout - Add glowing resize handles with color transitions (cyan → magenta → yellow) - Update page structure with header, version badge, and RGL link - Move incorrect transformScale example to end with explanatory text - Improve overall visual consistency with dark theme and neon accents
1 parent 61507fb commit 3dfc0b8

File tree

4 files changed

+524
-159
lines changed

4 files changed

+524
-159
lines changed

examples/ExampleLayout.js

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,27 @@ import React from 'react';
22
import Resizable from '../lib/Resizable';
33
import ResizableBox from '../lib/ResizableBox';
44
import 'style-loader!css-loader!../css/styles.css';
5-
import 'style-loader!css-loader!./example.css';
65

76
/* global __VERSION__, __GIT_TAG__, __GIT_COMMIT__ */
87

8+
// Update the version badge in the header
9+
function updateVersionBadge() {
10+
const badge = document.getElementById('version-badge');
11+
if (badge) {
12+
const version = __GIT_TAG__ || `v${__VERSION__}`;
13+
badge.textContent = version + (__GIT_COMMIT__ ? ` (${__GIT_COMMIT__})` : '');
14+
badge.href = `https://github.com/react-grid-layout/react-resizable/releases/tag/${__GIT_TAG__ || __VERSION__}`;
15+
}
16+
}
17+
18+
if (typeof document !== 'undefined') {
19+
if (document.readyState === 'loading') {
20+
document.addEventListener('DOMContentLoaded', updateVersionBadge);
21+
} else {
22+
updateVersionBadge();
23+
}
24+
}
25+
926
const CustomResizeHandle = React.forwardRef((props, ref) => {
1027
const {handleAxis, ...restProps} = props;
1128
return (
@@ -66,11 +83,6 @@ export default class ExampleLayout extends React.Component<{}, {width: number, h
6683
render() {
6784
return (
6885
<div>
69-
<p className="version-info">
70-
react-resizable {__GIT_TAG__ || __VERSION__}
71-
{__GIT_COMMIT__ && <span> ({__GIT_COMMIT__})</span>}
72-
</p>
73-
7486
<h3>Statically Positioned Layout</h3>
7587
<div className="layoutRoot">
7688
<Resizable className="box" height={this.state.height} width={this.state.width} onResize={this.onFirstBoxResize} resizeHandles={['sw', 'se', 'nw', 'ne', 'w', 'e', 'n', 's']}>
@@ -174,18 +186,16 @@ export default class ExampleLayout extends React.Component<{}, {width: number, h
174186
<div style={{marginBottom: '10px'}}>
175187
<small>
176188
If you are nesting Resizables in an element with <code>transform: scale(n)</code>, be sure to pass the same <code>n</code>&nbsp;
177-
as the <code>transformScale</code> property.
178-
<br />
179-
This box has scale 0.75.
189+
as the <code>transformScale</code> property. This layout has <code>scale(0.75)</code>.
180190
</small>
181191
</div>
182192
<div className="layoutRoot absoluteLayout scaledLayout">
183-
<ResizableBox className="box absolutely-positioned top-aligned left-aligned" width={200} height={200} resizeHandles={['sw', 'se', 'nw', 'ne', 'w', 'e', 'n', 's']}>
184-
<span className="text">{"<ResizableBox> with incorrect scale 1"}</span>
193+
<ResizableBox className="box absolutely-positioned top-aligned left-aligned" width={200} height={200} transformScale={0.75} resizeHandles={['sw', 'se', 'nw', 'ne', 'w', 'e', 'n', 's']}>
194+
<span className="text">{"<ResizableBox> with correct transformScale={0.75}"}</span>
185195
</ResizableBox>
186196

187197
<ResizableBox className="box absolutely-positioned bottom-aligned left-aligned" width={200} height={200} transformScale={0.75} resizeHandles={['sw', 'se', 'nw', 'ne', 'w', 'e', 'n', 's']}>
188-
<span className="text">{"<ResizableBox> with correct scale 0.75"}</span>
198+
<span className="text">{"<ResizableBox> with correct transformScale={0.75}"}</span>
189199
</ResizableBox>
190200

191201
{/* See implementation of `onResizeAbsolute` for how this can be moved around its container */}
@@ -209,11 +219,11 @@ export default class ExampleLayout extends React.Component<{}, {width: number, h
209219
</Resizable>
210220

211221
<ResizableBox className="box absolutely-positioned top-aligned right-aligned" width={200} height={200} transformScale={0.75} resizeHandles={['sw', 'se', 'nw', 'ne', 'w', 'e', 'n', 's']}>
212-
<span className="text">{"<ResizableBox> with correct scale 0.75"}</span>
222+
<span className="text">{"<ResizableBox> with correct transformScale={0.75}"}</span>
213223
</ResizableBox>
214224

215-
<ResizableBox className="box absolutely-positioned bottom-aligned right-aligned" width={200} height={200} transformScale={0.75} resizeHandles={['sw', 'se', 'nw', 'ne', 'w', 'e', 'n', 's']}>
216-
<span className="text">{"<ResizableBox> with correct scale 0.75"}</span>
225+
<ResizableBox className="box absolutely-positioned bottom-aligned right-aligned" width={200} height={200} resizeHandles={['sw', 'se', 'nw', 'ne', 'w', 'e', 'n', 's']}>
226+
<span className="text">{"Without transformScale - notice how the cursor diverges from the handle while dragging"}</span>
217227
</ResizableBox>
218228
</div>
219229

0 commit comments

Comments
 (0)