Skip to content

Commit 081e7d9

Browse files
committed
modalの表示修正
1 parent a311e64 commit 081e7d9

File tree

6 files changed

+28
-16
lines changed

6 files changed

+28
-16
lines changed

src/ui-components/Ability.svelte

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22
import Key from "./Key.svelte";
33
type Props = { name: string; key: string; count: number };
44
const { name, count, key }: Props = $props();
5-
let isMacOS: boolean = $state(false);
6-
$effect(() => {
7-
isMacOS = navigator.userAgent.includes("Mac OS X");
8-
});
95
</script>
106
<span style="margin-right: 1rem; display: flex; align-items: end; color: {count > 0 ? "black" : "gray"};">
11-
<Key key={isMacOS ? "⌘+" + key : "Ctrl+" + key} enabled={count > 0} />
7+
<Key withCtrl key={key} enabled={count > 0} />
128
<span style="margin-left:0.5rem; margin-right: 0.5rem;">{name}</span>
139
{#if isFinite(count)}
1410
<span style="margin-right: 0.5rem; ">x</span>

src/ui-components/Key.svelte

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
<script lang="ts">
2-
type Props = { key: string; enabled: boolean };
3-
const { key, enabled }: Props = $props();
2+
type Props = { key: string; enabled: boolean; withCtrl?: boolean };
3+
const { key, enabled, withCtrl }: Props = $props();
4+
let isMacOS: boolean = $state(false);
5+
$effect(() => {
6+
isMacOS = navigator.userAgent.includes("Mac OS X");
7+
});
48
</script>
5-
<span class="key" style="border-color: {enabled ? "black" : "gray"}; background: {enabled ? "white" : "lightgray"};">
6-
{key}
9+
10+
<span
11+
class="key"
12+
style="border-color: {enabled ? 'black' : 'gray'}; background: {enabled
13+
? 'white'
14+
: 'lightgray'};"
15+
>
16+
{(withCtrl ? (isMacOS ? "⌘+" : "Ctrl+") : "") + key}
717
</span>
18+
819
<style>
9-
.key{
20+
.key {
1021
display: inline-block;
1122
font-family: system-ui;
1223
font-size: 1rem;

src/ui-components/menu/GameOverMenu.svelte

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import Key from "../Key.svelte";
23
import "./menu.css";
34
45
type Props = {
@@ -21,8 +22,11 @@ document.addEventListener("keydown", (ev) => {
2122

2223
<dialog bind:this={el} class="modal">
2324
<div class="modal-box flex flex-col gap-1">
24-
<h1 class="text-4xl text-center mt-6 mb-2">Game Over</h1>
25-
<p class="text-xl text-center text-gray-500 mb-4">ctrl+Z で戻る</p>
25+
<h1 class="text-center mt-6 mb-2">Game Over</h1>
26+
<p class="text-center text-gray-500 mb-2 flex flex-row justify-center items-end ">
27+
<span class="mr-2 ">Back with</span>
28+
<Key key="Z" withCtrl enabled />
29+
</p>
2630
<button
2731
class="btn modal-btn"
2832
onclick={() => {

src/ui-components/menu/GoalMenu.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ onDestroy(() => {
3030

3131
<dialog bind:this={el} class="modal">
3232
<div class="modal-box flex flex-col gap-1">
33-
<h1 class="text-4xl text-center my-6">Goal!</h1>
33+
<h1 class="text-center my-6">Goal!</h1>
3434
<a class="btn modal-btn" href={nextStageUrl}> Next Stage </a>
3535
<button
3636
class="btn modal-btn"

src/ui-components/menu/PauseMenu.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ document.addEventListener("keydown", (ev) => {
2828

2929
<dialog bind:this={el} onclose={onresume} class="modal">
3030
<div class="modal-box flex flex-col gap-1">
31-
<h1 class="text-4xl text-center my-6">Paused</h1>
31+
<h1 class="text-center my-6">Paused</h1>
3232
<form method="dialog" class="w-full">
3333
<button class="btn modal-btn" type="submit">Resume</button>
3434
</form>

src/ui-components/menu/menu.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
.modal-btn {
22
width: 100%;
33
margin-top: 0.5rem;
4-
font-size: 1.5rem;
5-
padding: 0.5rem;
4+
padding: 0.6rem 0 0; /* Fleftexフォント側で文字が上に寄っているので */
65
border-radius: 0.5rem;
6+
font-size: inherit;
7+
height: max-content;
78
}
89
.modal-box {
910
background: oklch(82.8% 0.189 84.429 / 40%);

0 commit comments

Comments
 (0)