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

Implement mobile friendly doc page #98

Merged
merged 1 commit into from
Nov 10, 2023
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
112 changes: 70 additions & 42 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta charset="utf-8" />
<title>Mathup</title>

<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="shortcut" type="image/x-icon" href="favicon.ico" />
<link rel="stylesheet" href="main.css" />

Expand Down Expand Up @@ -82,56 +83,83 @@ <h1>Mathup</h1>
<nav class="main-nav">
<ul>
<li>
<a href="#use">Use</a>

<ul>
<li><a href="#installation">Installation</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#options">Options</a></li>
</ul>
<details>
<summary>Use</summary>

<ul>
<li><a href="#installation">Installation</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#options">Options</a></li>
</ul>
</details>
</li>
<li>
<a href="#philosophy">Philosophy</a>

<ul>
<li>
<a href="#quick-to-write-easy-to-read">
Quick to write / Easy to read
</a>
</li>
<li><a href="#why-not-mathjax">Why not just use MathJax</a></li>
<li><a href="#why-not-tex">Why AsciiMath / Why not TeΧ</a></li>
</ul>
<li>
<details>
<summary>Philosophy</summary>

<ul>
<li>
<a href="#quick-to-write-easy-to-read">
Quick to write / Easy to read
</a>
</li>
<li><a href="#why-not-mathjax">Why not just use MathJax</a></li>
<li><a href="#why-not-tex">Why AsciiMath / Why not TeΧ</a></li>
</ul>
</details>
</li>

<li>
<a href="#reference">Reference</a>

<ul>
<li><a href="#basics">Basics</a></li>
<li><a href="#numbers">Numbers</a></li>
<li><a href="#operators">Operators</a></li>
<li><a href="#identifiers">Identifiers</a></li>
<li><a href="#text">Text</a></li>
<li><a href="#spaces">Spaces</a></li>
<li><a href="#fractions">Fractions</a></li>
<li><a href="#sub-and-superscripts">Sub and superscripts</a></li>
<li><a href="#fenced-groups">Fenced groups</a></li>
<li><a href="#matrices">Matrices</a></li>
<li><a href="#roots">Roots</a></li>
<li><a href="#accents">Accents</a></li>
<li><a href="#font-commands">Font commands</a></li>
<li><a href="#colors">Colors</a></li>
</ul>
<details>
<summary>Reference</summary>

<ul>
<li><a href="#reference">Reference</a></li>
<li><a href="#basics">Basics</a></li>
<li><a href="#numbers">Numbers</a></li>
<li><a href="#operators">Operators</a></li>
<li><a href="#identifiers">Identifiers</a></li>
<li><a href="#text">Text</a></li>
<li><a href="#spaces">Spaces</a></li>
<li><a href="#fractions">Fractions</a></li>
<li>
<a href="#sub-and-superscripts">Sub and superscripts</a>
</li>
<li><a href="#fenced-groups">Fenced groups</a></li>
<li><a href="#matrices">Matrices</a></li>
<li><a href="#roots">Roots</a></li>
<li><a href="#accents">Accents</a></li>
<li><a href="#font-commands">Font commands</a></li>
<li><a href="#colors">Colors</a></li>
</ul>
</details>
</li>

<li>
<a href="https://github.com/runarberg/mathup">Source Code</a>
<ul>
<li>
<a href="https://github.com/runarberg/mathup">GitHub</a>
</li>
</ul>
<details>
<summary>Open Source</summary>

<ul>
<li>
<a href="https://github.com/runarberg/mathup">GitHub</a>
</li>

<li>
<a href="https://github.com/runarberg/mathup/issues">
Bug Reports
</a>
</li>

<li>
<a
href="https://github.com/runarberg/mathup/blob/main/LICENSE"
>
License (MIT)
</a>
</li>
</ul>
</details>
</li>
</ul>
</nav>
Expand Down
104 changes: 84 additions & 20 deletions docs/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ use-example::part(math) {
font-family: "Libertinus Math", "Asana Math", math;
}

use-example::part(math) {
font-size: 1.2em;
}

code {
background: #f0f0f0;
}
Expand Down Expand Up @@ -118,6 +122,10 @@ h5 {
font-size: 1.05em;
}

summary {
cursor: pointer;
}

body > header {
text-align: center;
}
Expand All @@ -133,52 +141,48 @@ body > header h1 {
}

.main-nav > ul {
border-top: 1px solid black;
border-bottom: 1px solid black;
border-block: 1px solid black;
display: flex;
}

.main-nav > ul > li {
flex-basis: 100%;
flex-grow: 1;
flex-basis: 15ch;
position: relative;
}

.main-nav > ul > li > a {
.main-nav summary {
cursor: pointer;
display: block;
font-weight: bold;
font-size: 1.2em;
text-align: center;
}

.main-nav > ul > li > ul {
.main-nav details ul {
background: white;
border-block-start: 1px solid white;
border-block-end: 2px solid black;
display: none;
border-inline: 1px solid lightgray;
position: absolute;
left: 0;
right: 0;
}

.main-nav > ul > li:focus-within > ul,
.main-nav > ul > li:hover > ul {
display: block;
}

.main-nav a {
display: block;
color: black;
text-decoration: none;
}

.main-nav > ul > li > ul a {
.main-nav details ul a {
padding-inline: 1em;
}

.main-nav summary:hover,
.main-nav details[open] summary,
.main-nav a:hover,
.main-nav a:focus,
.main-nav > ul > li:hover > a,
.main-nav > ul > li:focus-within > a {
.main-nav a:focus {
background: black;
color: white;
}
Expand Down Expand Up @@ -214,7 +218,7 @@ body > header h1 {
}

.try > .input .options {
margin-left: 2em;
margin-inline-start: 2em;
}

.try > .input input + label::before {
Expand All @@ -233,9 +237,9 @@ body > header h1 {
}

.try > .output {
border-left: 1px solid black;
border-inline-start: 1px solid black;
flex: 0 1 60%;
padding-left: 1em;
padding-inline-start: 1em;
}

.try > .output output {
Expand All @@ -261,7 +265,7 @@ article p {
}

article section + section {
margin-top: 2em;
margin-block-start: 2em;
}

#philosophy,
Expand Down Expand Up @@ -319,5 +323,65 @@ article section + section {
}

.examples li + li {
margin-top: 2em;
margin-block-start: 2em;
}

@media screen and (max-width: 80ch) {
.try {
flex-direction: column;
}

.try > .input {
order: 2;
}

.try > .output {
border-inline-start: none;
flex-basis: 100%;
padding-inline: 0;
order: 1;
}

.main-nav > ul {
flex-direction: column;
}

.main-nav > ul details > ul {
position: static;
}

.reference-section > section {
display: block;
}

.reference-section > section .examples {
margin-block: 1em;
}

.reference-section > section .examples > ul {
margin: 0;
align-items: start;
column-gap: 1em;
display: flex;
overflow-y: auto;
padding-block-end: 1em;
scroll-snap-type: x mandatory;
}
.reference-section > section .examples > ul > li {
margin-block: 0;
scroll-snap-align: center;
scroll-snap-stop: always;
}

use-example {
display: flex;
flex-direction: column;
inline-size: calc(100vw - 2em);
justify-content: space-between;
row-gap: 1em;
}

use-example::part(code) {
max-inline-size: calc(100% - 2em);
}
}
Loading