change SplitView to vertical on mobile

This commit is contained in:
Moritz Hölting 2024-08-21 11:53:28 +00:00
parent 386ee37ca7
commit b03a43a04c
4 changed files with 27 additions and 18 deletions

View File

@ -10,9 +10,9 @@ All commands are run from the root of the project, from a terminal:
| Command | Action | | Command | Action |
| :------------------------ | :----------------------------------------------- | | :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies | | `pnpm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:4321` | | `pnpm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` | | `pnpm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying | | `pnpm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | | `pnpm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `npm run astro -- --help` | Get help using the Astro CLI | | `pnpm run astro -- --help` | Get help using the Astro CLI |

View File

@ -17,5 +17,6 @@
"shiki": "^1.14.1", "shiki": "^1.14.1",
"starlight-links-validator": "^0.10.1", "starlight-links-validator": "^0.10.1",
"typescript": "^5.4.5" "typescript": "^5.4.5"
} },
"packageManager": "pnpm@9.7.0+"
} }

View File

@ -6,18 +6,26 @@ const { gap = "0px" } = Astro.props;
--- ---
<div class="split-view" style={`gap: ${gap}`}> <div class="split-view" style={`gap: ${gap}`}>
<slot name="left" /> <div><slot name="left" /></div>
<slot name="right" /> <div><slot name="right" /></div>
</div> </div>
<style> <style>
.split-view { .split-view {
display: grid; display: grid;
grid-template-columns: 1fr 1fr; grid-template-rows: auto auto;
grid-template-columns: auto;
} }
.split-view > :global(*) { .split-view > :global(*) {
overflow: hidden;
margin-top: 0 !important; margin-top: 0 !important;
overflow: hidden;
}
@media only screen and (min-width: 640px) {
.split-view {
grid-template-rows: auto;
grid-template-columns: 1fr 1fr;
}
} }
</style> </style>

View File

@ -172,7 +172,7 @@ ShulkerScript and mcscript offer a more convenient way to write if-else statemen
``` ```
</TabItem> </TabItem>
</Tabs> </Tabs>
<div slot="right"> <Fragment slot="right">
<Tabs syncKey="comparisonLang" style="margin-top: 0"> <Tabs syncKey="comparisonLang" style="margin-top: 0">
<TabItem label="mcfunction"> <TabItem label="mcfunction">
```mcfunction ```mcfunction
@ -196,7 +196,7 @@ ShulkerScript and mcscript offer a more convenient way to write if-else statemen
When working with else statements and/or commands that could affect the condition, When working with else statements and/or commands that could affect the condition,
both the mcfunction and mcscript approach could lead to unexpected results as explained [here](#interfering-with-conditions). both the mcfunction and mcscript approach could lead to unexpected results as explained [here](#interfering-with-conditions).
</Aside> </Aside>
</div> </Fragment>
</SplitView> </SplitView>
### Logical operators ### Logical operators
@ -205,7 +205,7 @@ Both in ShulkerScript and mcscript, logical operators can be used to combine mul
In the following code examples, the conditions are represented by `A`, `B`, etc. as placeholders for real conditions. In the following code examples, the conditions are represented by `A`, `B`, etc. as placeholders for real conditions.
<SplitView gap="10px"> <SplitView gap="10px">
<div slot="left"> <Fragment slot="left">
<Tabs> <Tabs>
<TabItem label="ShulkerScript"> <TabItem label="ShulkerScript">
```shulkerscript ```shulkerscript
@ -220,8 +220,8 @@ In the following code examples, the conditions are represented by `A`, `B`, etc.
</Tabs> </Tabs>
The AND operator takes precedence over the OR operator, so the above code is equivalent to `A && (B || C)`. The AND operator takes precedence over the OR operator, so the above code is equivalent to `A && (B || C)`.
The code is compiled in such a way, that regardless in which way the expression is true, the command will only run once. The code is compiled in such a way, that regardless in which way the expression is true, the command will only run once.
</div> </Fragment>
<div slot="right"> <Fragment slot="right">
<Tabs syncKey="comparisonLang" style="margin-top: 0"> <Tabs syncKey="comparisonLang" style="margin-top: 0">
<TabItem label="mcfunction"> <TabItem label="mcfunction">
```mcfunction ```mcfunction
@ -245,7 +245,7 @@ In the following code examples, the conditions are represented by `A`, `B`, etc.
<Aside type="caution" title=""> <Aside type="caution" title="">
If both `A && B` and `C` are true, the command will run two times! If both `A && B` and `C` are true, the command will run two times!
</Aside> </Aside>
</div> </Fragment>
</SplitView> </SplitView>
### Interfering with conditions ### Interfering with conditions
@ -278,7 +278,7 @@ execute unless block ~ ~-1 ~ minecraft:stone run say Not on stone
## Embedded Programming Language ## Embedded Programming Language
ShulkerScript allows running Lua code during compilation and running the returned output in Minecraft, mcscript offers JavaScript modals._createMdxContent ShulkerScript allows running Lua code during compilation and running the returned output in Minecraft, mcscript offers JavaScript modals.
<SplitView gap="10px"> <SplitView gap="10px">
<Tabs slot="left"> <Tabs slot="left">