Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<title>Visual JavaScript</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://unpkg.com/react@16.14.0/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.13.1/umd/react-dom.development.js"></script>
<link
Expand Down
7 changes: 4 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ const App = () => {
height: undefined
});
const [edits, setEdits] = React.useState([]);
const isMobile = window.innerWidth <= 768;
const [layout, setLayout] = React.useState({
slider: true,
editor: true,
slider: !isMobile,
editor: !isMobile,
});
const [source, setSource] = React.useState(manager.getSource());

Expand Down Expand Up @@ -108,7 +109,7 @@ const App = () => {
{ className: "ui form" },
React.createElement(
"textarea",
{ className: "", ref: sourceText, defaultValue: source, cols: "80", rows: "10" },
{ className: "", ref: sourceText, defaultValue: source, rows: isMobile ? "5" : "10" },
)
),

Expand Down
47 changes: 46 additions & 1 deletion src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
z-index: 9;
padding: 20px;
background: white;
box-sizing: border-box;
}
.source-code textarea {
width: 100%;
box-sizing: border-box;
resize: vertical;
}
.layout {
position: fixed;
Expand Down Expand Up @@ -43,7 +49,7 @@
}

.excalidraw-wrapper {
height: 800px;
height: 100vh;
position: relative;
}

Expand All @@ -53,3 +59,42 @@
.zen-mode-transition.App-menu_bottom--transition-left {
transform: none;
}

/* ── Mobile styles ──────────────────────────────────────────────── */
@media (max-width: 768px) {
/* Layout toggle buttons: pin to top-left corner */
.layout {
left: 8px;
margin-left: 0;
top: 8px;
background: rgba(255, 255, 255, 0.92);
border-radius: 6px;
padding: 4px;
}

/* Source-code panel: tighter padding, fewer rows handled via JS */
.source-code {
padding: 10px;
}

/* Right rail → full-width panel pinned to the top on mobile */
.ui.right.rail {
position: fixed !important;
top: 0 !important;
left: 0 !important;
right: 0 !important;
bottom: auto !important;
width: 100% !important;
max-height: 50vh;
overflow-y: auto;
border-left: none !important;
border-bottom: 1px solid #ddd;
}

/* Let buttons wrap naturally on narrow screens */
.button-wrapper {
display: flex;
flex-wrap: wrap;
align-items: center;
}
}