Skip to content

Commit 93095ec

Browse files
committed
adjust layout and make preview border non-nullable
1 parent 31217e7 commit 93095ec

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

src/components/Index.svelte renamed to src/components/Home.svelte

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
</script>
1010

1111
<main class="layout">
12-
<div style="">
12+
<div class="panel-about">
1313
<AboutPanel />
1414
</div>
1515

16-
<div style="">
16+
<div class="panel-theme-options" style="">
1717
<Box
1818
title="Theme Options"
1919
style="display: flex; flex-direction: column; height: 100%;"
@@ -23,7 +23,7 @@
2323
</Box>
2424
</div>
2525

26-
<div>
26+
<div class="panel-palette">
2727
<Box
2828
title="Color Palette"
2929
style="display: flex; flex-direction: column; height: 100%;"
@@ -33,12 +33,12 @@
3333
</Box>
3434
</div>
3535

36-
<div style="display: flex; gap: var(--box-gap); width: 100%;">
36+
<div class="panel-color-picker" style="display: flex; gap: var(--box-gap); width: 100%;">
3737
<Box title="Color Picker" style="flex: 0 1 300px" contentStyle="height: 100%;">
3838
<ColorPicker />
3939
</Box>
4040

41-
<div style="flex: 1; display: flex; flex-direction: column; gap: 10px;">
41+
<div class="panel-terminal" style="flex: 1; display: flex; flex-direction: column; gap: 10px;">
4242
<Box title="Preview" style="flex: 1;">
4343
<TerminalWindow />
4444
</Box>
@@ -55,9 +55,9 @@
5555
display: grid;
5656
gap: var(--box-gap);
5757
grid-template-columns: 350px 1fr;
58+
grid-template-rows: 350px auto;
5859
align-items: stretch;
5960
justify-content: stretch;
60-
grid-template-rows: 320px auto;
6161
align-items: stretch;
6262
align-content: stretch;
6363
height: 100%;

src/components/OptionsPanel.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import FormControl from '~/components/common/FormControl.svelte';
3-
import { borderTypes, infoTypes, layoutTypes } from '~/data/fzfBorders';
3+
import { borderTypes, borderTypesNonNullable, infoTypes, layoutTypes } from '~/data/fzfBorders';
44
import { themeStore } from '~/data/themeStore';
55
import InputCycle from '~/components/common/InputCycle.svelte';
66
import { boxCoordinatesToString, stringToBoxCoordinates } from '~/utils/boxCoordinates';
@@ -49,7 +49,7 @@
4949

5050
<FormControl label="Preview">
5151
<InputCycle
52-
items={borderTypes}
52+
items={borderTypesNonNullable}
5353
value={$themeStore.previewBorderStyle}
5454
showIndex
5555
on:change={(e) => {
@@ -76,7 +76,7 @@
7676
<FormControl label="Margin">
7777
<input
7878
type="text"
79-
pattern={'^[0-9](,[0-9]){0,3}$'}
79+
pattern={'^[0-9]+(,[0-9]+){0,3}$'}
8080
value={boxCoordinatesToString($themeStore.margin)}
8181
on:input={(e) => {
8282
const coords = stringToBoxCoordinates(e.target?.value);
@@ -91,7 +91,7 @@
9191
<FormControl label="Padding">
9292
<input
9393
type="text"
94-
pattern={'^[0-9](,[0-9]){0,3}$'}
94+
pattern={'^[0-9]+(,[0-9]+){0,3}$'}
9595
value={boxCoordinatesToString($themeStore.padding)}
9696
on:input={(e) => {
9797
const coords = stringToBoxCoordinates(e.target?.value);

src/data/fzfBorders.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export type BorderTypeGlyphs = {
1010
};
1111

1212
export type BorderStyle = 'rounded' | 'sharp' | 'bold' | 'double' | 'block' | 'thinblock' | 'none';
13+
export type BorderStyleNonNullable = Exclude<BorderStyle, 'none'>;
1314

1415
// @todo: add border disclaimers for block and thinblock
1516
export const BorderStyleDefinitions: Record<BorderStyle, BorderTypeGlyphs> = {
@@ -101,6 +102,7 @@ export const BorderStyleDefinitions: Record<BorderStyle, BorderTypeGlyphs> = {
101102
};
102103

103104
export const borderTypes = Object.keys(BorderStyleDefinitions) as BorderStyle[];
105+
export const borderTypesNonNullable = borderTypes.filter((item) => item !== 'none');
104106

105107
export const layoutTypes = ['default' as const, 'reverse' as const, 'reverse-list' as const];
106108
export type Layout = (typeof layoutTypes)[number];

src/data/themeStore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { writable } from 'svelte/store';
2-
import type { BorderStyle, InfoStyle, Layout } from '~/data/fzfBorders';
2+
import type { BorderStyle, BorderStyleNonNullable, InfoStyle, Layout } from '~/data/fzfBorders';
33

44
export type BoxCoordinates = {
55
top: number;
@@ -12,7 +12,7 @@ export type ThemeOptions = {
1212
borderStyle: BorderStyle;
1313
borderLabel: string;
1414
borderLabelPosition: number;
15-
previewBorderStyle: BorderStyle;
15+
previewBorderStyle: BorderStyleNonNullable;
1616
padding: BoxCoordinates;
1717
margin: BoxCoordinates;
1818
prompt: string;

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import AppIndex from './components/Index.svelte';
1+
import Home from './components/Home.svelte';
22

33
import './styles/main.css';
44

5-
const app = new AppIndex({
5+
const app = new Home({
66
target: document.getElementById('app') as HTMLElement,
77
});
88

0 commit comments

Comments
 (0)