Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playground: Refactoring CSS #128

Merged
merged 4 commits into from
Jul 13, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions example/z-playground/client/client.eml.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@
</head>
<body>

<div id="editor">
<div id="editor" class="panel">
<header>
<h1>Dream Playground</h1>
<button id="run">Run</button>
<button id="chview">Change View</button>
<%s! backlink %>
</header>
<div id="textarea"></div>
<div id="textarea" class="panel-fluid"></div>
<pre id="log"></pre>
</div>
<div id="client">
<div id="client" class="panel">
<header>
<input id="location"></input>
</header>
<iframe title="Client connecting to the playground server"></iframe>
<iframe title="Client connecting to the playground server" class="panel-fluid"></iframe>
</div>

<script src="/static/playground.js"></script>
Expand Down
113 changes: 90 additions & 23 deletions example/z-playground/client/playground.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,74 @@

Copyright 2021 Anton Bachin */

/*

Playground layout: 2 panels with normal element and fluid
┌──────────────────────────────────────────────────┐
│ │
│ body (desktop) │
│ │
│ ┌───────────────────────┐ ┌────────────────────┐ │
│ │ │ │ │ │
│ │ ┌───────────────────┐ │ │ ┌────────────────┐ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ .panel-element │ │ │ │ .panel-element │ │ │
│ │ ├───────────────────┤ │ │ ├────────────────┤ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ .panel-fluid │ │ │ │ .panel-fluid │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ └───────────────────┘ │ │ └────────────────┘ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ └───────────────────────┘ └────────────────────┘ │
│ │
└──────────────────────────────────────────────────┘

This is on mobile or when pressing Change
┌──────────────────────────────────────────────────┐
│ │
│ body (mobile/Change view actived) │
│ ┌──────────────────────────────────────────────┐ │
│ │ │ │
│ │ ┌──────────────────────────────────────────┐ │ │
│ │ │ .panel-element │ │ │
│ │ │ │ │ │
│ │ ├──────────────────────────────────────────┤ │ │
│ │ │ .panel-fluid │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ └──────────────────────────────────────────┘ │ │
│ │ │ │
│ ├──────────────────────────────────────────────┤ │
│ │ │ │
│ │ ┌──────────────────────────────────────────┐ │ │
│ │ │ .panel-element │ │ │
│ │ │ │ │ │
│ │ ├──────────────────────────────────────────┤ │ │
│ │ │ .panel-fluid │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ └──────────────────────────────────────────┘ │ │
│ │ │ │
│ └──────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────┘
*/
body {
margin: 0;
font-size: 14px;
Expand All @@ -21,35 +89,43 @@ body {
}
}

/* This is for when pressing Change View button */
.panel {
flex: 0 0 50%;
width: 50%;
display: flex;
flex-direction: column;
}
.panel-fluid {
flex: 1 0 auto;
min-height: 300px;
}

/*
* Change view activation and mobile mode is the same
* Please ensure that they are in perfect sync
*/
body.full-editor {
flex-direction: column;
overflow-y: auto;
height: auto;
}
.full-editor #editor, .full-editor #client {
flex: 1 1 100%;
width: 100%;
}

#editor, #client {
flex: 0 0 50%;
width: 50%;
display: flex;
flex-direction: column;
.full-editor .panel {
width: 100%;
}

@media (max-width: 1100px) {
#editor, #client {
width: 100%;
}
body {
flex-direction: column;
overflow-y: auto;
height: auto;
}
.panel {
width: 100%;
}
}

#textarea {
flex: 1 0 auto;
position: relative;
}
#textarea .CodeMirror {
Expand All @@ -61,12 +137,6 @@ body.full-editor {
right: 0;
}

#client iframe {
flex: 1 0 auto;
}



header {
height: 64px;
display: flex;
Expand Down Expand Up @@ -146,8 +216,6 @@ h1 {
background: #555;
}



/* Client */

#client header {
Expand Down Expand Up @@ -177,7 +245,6 @@ h1 {
}



/* Syntax */

.cm-s-dream.CodeMirror, body {
Expand Down