-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a checkbox to PlayableMapPane's titlebar to dim inaccessible rooms
Moved titlebar handling to each pane Closes #7
- Loading branch information
1 parent
acf8854
commit eb1d7a0
Showing
16 changed files
with
254 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script lang="ts"> | ||
export let minimize: () => void; | ||
</script> | ||
|
||
<button type="button" on:click={minimize}> | ||
<div>━</div> | ||
</button> | ||
|
||
<style> | ||
div { | ||
font-weight: bold; | ||
padding: .1em; | ||
border-radius: 25%; | ||
aspect-ratio: 1 / 1; | ||
line-height: 1em; | ||
} | ||
button { | ||
margin-left: auto; | ||
font-size: inherit; | ||
background: none; | ||
border: none; | ||
padding: .15em; | ||
cursor: pointer; | ||
&:hover > div { | ||
background-color: #fff; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,23 @@ | ||
<script lang="ts"> | ||
import { Pane } from "svelte-splitpanes"; | ||
import type { DefinitionDashPaneProps } from "./types"; | ||
import type { PaneProps } from "./types"; | ||
export let props: DefinitionDashPaneProps; | ||
export let props: PaneProps; | ||
</script> | ||
|
||
<Pane> | ||
<div id="pane"> | ||
{#if props.showName || props.allowClosing} | ||
<div id="bar"> | ||
{#if props.showName} | ||
<span id="name">{props.name}</span> | ||
{/if} | ||
{#if props.allowClosing} | ||
<button type="button" on:click={() => props.shown = !props.shown}> | ||
<span>━</span> | ||
</button> | ||
{/if} | ||
</div> | ||
{/if} | ||
<div id="component"> | ||
<svelte:component this={props.component} {...props.componentProps} bind:this={props.binding}/> | ||
</div> | ||
<div> | ||
<svelte:component | ||
this={props.component} bind:this={props.binding} | ||
{...props.componentProps} minimize={() => props.shown = !props.shown} | ||
/> | ||
</div> | ||
</Pane> | ||
|
||
<style lang="scss"> | ||
#pane { | ||
<style> | ||
div { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100%; | ||
} | ||
#bar { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
border-bottom: 1px solid #aaa; | ||
background: #d8d8d8; | ||
font-family: "Segoe UI", Arial, sans-serif; | ||
} | ||
#name { | ||
padding: 0 .5em; | ||
} | ||
button { | ||
font-weight: bold; | ||
background: none; | ||
border: none; | ||
aspect-ratio: 1 / 1; | ||
line-height: 1em; | ||
padding: .2em; | ||
cursor: pointer; | ||
& > span { | ||
padding: .2em; | ||
border-radius: 25%; | ||
} | ||
&:hover > span { | ||
background-color: #fff; | ||
} | ||
} | ||
#component { | ||
position: relative; | ||
flex-grow: 1; | ||
overflow: auto; /* I'm not sure why but this fixes the height of SVGMap */ | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div id="title"><slot/></div> | ||
|
||
<style> | ||
#title { | ||
padding: 0 .5em; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<div id="bar"><slot/></div> | ||
|
||
<style> | ||
#bar { | ||
display: flex; | ||
align-items: center; | ||
border-bottom: 1px solid #aaa; | ||
background: #d8d8d8; | ||
font-family: "Segoe UI", Arial, sans-serif; | ||
min-height: 1.5em; | ||
height: 1.5em; | ||
white-space: nowrap; | ||
text-overflow: ellipsis; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,22 @@ | ||
import type { ComponentProps, ComponentType, SvelteComponent } from "svelte"; | ||
|
||
export type DefinitionDashPaneProps< | ||
T extends SvelteComponent = SvelteComponent, | ||
> = { | ||
export type PaneProps<T extends SvelteComponent = SvelteComponent> = { | ||
name: string; | ||
component: ComponentType<T>; | ||
componentProps: ComponentProps<T>; | ||
componentProps: Omit<ComponentProps<T>, "minimize">; | ||
shown: boolean; | ||
showName: boolean; | ||
allowClosing: boolean; | ||
binding?: T; | ||
}; | ||
export function createPane<T extends SvelteComponent>( | ||
name: string, | ||
component: ComponentType<T>, | ||
componentProps: ComponentProps<T>, | ||
componentProps: Omit<ComponentProps<T>, "minimize">, | ||
shown?: boolean, | ||
showName?: boolean, | ||
allowClosing?: boolean, | ||
): DefinitionDashPaneProps<T> { | ||
): PaneProps<T> { | ||
return { | ||
name, | ||
component, | ||
componentProps, | ||
shown: !!shown, | ||
showName: !!showName, | ||
allowClosing: !!allowClosing, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/routes/(requires-login)/game/[gameId=id]/GuidePane.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.