Skip to content

Commit 4635dbf

Browse files
author
sunzhongyi
committed
feat: opt styles
1 parent c45c617 commit 4635dbf

File tree

2 files changed

+51
-9
lines changed

2 files changed

+51
-9
lines changed

webviews/commit-editor/App.svelte

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
}
160160
</script>
161161

162-
<main class="p-4 sm:p-6 font-sans flex flex-col h-screen">
162+
<main class="p-4 sm:p-6 font-sans flex flex-col h-full">
163163
<div class="flex-shrink-0">
164164
<div class="flex justify-between items-center mb-4">
165165
<h1 class="text-xl font-bold">🤖 Commit Assistant</h1>
@@ -170,7 +170,7 @@
170170
<Tabs bind:currentTab={currentView} />
171171
</div>
172172

173-
<div class="flex-grow overflow-y-auto mt-4">
173+
<div class="flex-grow overflow-y-auto mt-4 pr-4">
174174
{#if currentView === 'form'}
175175
<FormView
176176
bind:commitData
@@ -209,5 +209,14 @@
209209
:global(body) {
210210
background-color: var(--vscode-editor-background);
211211
color: var(--vscode-editor-foreground);
212+
margin: 0;
213+
padding: 0;
214+
height: 100vh;
215+
overflow: hidden;
216+
}
217+
218+
:global(html) {
219+
height: 100vh;
220+
overflow: hidden;
212221
}
213222
</style>

webviews/commit-editor/components/FormView.svelte

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
let aiFieldConfig = {
2323
scope: false,
2424
body: false,
25-
footer: false,
2625
}
2726
2827
const dispatch = createEventDispatcher()
@@ -56,7 +55,7 @@
5655
<label for="type" class="block text-sm font-medium mb-1">Type</label>
5756
<CustomSelect items={commitTypes} selectedValue={commitData.type} on:change={(e) => update('type', e.detail)} placeholder="Select type..." />
5857
</div>
59-
<div class="flex items-center justify-between">
58+
<div class="flex items-center justify-between pr-2">
6059
<label for="scope" class="block text-sm font-medium">Scope <span class="text-gray-400">(optional)</span></label>
6160
<input type="checkbox" bind:checked={aiFieldConfig.scope} title="Generate AI content for this field" />
6261
</div>
@@ -73,16 +72,15 @@
7372
maxlength="72"
7473
/>
7574
</div>
76-
<div class="flex items-center justify-between">
75+
<div class="flex items-center justify-between pr-2">
7776
<label for="body" class="block text-sm font-medium">Body <span class="text-gray-400">(optional)</span></label>
7877
<input type="checkbox" bind:checked={aiFieldConfig.body} title="Generate AI content for this field" />
7978
</div>
8079
<textarea id="body" rows="4" class="w-full" value={commitData.body} on:input={(e) => update('body', e.currentTarget.value)} placeholder="Detailed description of changes"></textarea>
81-
<div class="flex items-center justify-between">
82-
<label for="footer" class="block text-sm font-medium">Footer <span class="text-gray-400">(optional)</span></label>
83-
<input type="checkbox" bind:checked={aiFieldConfig.footer} title="Generate AI content for this field" />
80+
<div>
81+
<label for="footer" class="block text-sm font-medium mb-1">Footer <span class="text-gray-400">(optional)</span></label>
82+
<textarea id="footer" rows="2" class="w-full" value={commitData.footer} on:input={(e) => update('footer', e.currentTarget.value)} placeholder="e.g., Closes #123, Breaking change info"></textarea>
8483
</div>
85-
<textarea id="footer" rows="2" class="w-full" value={commitData.footer} on:input={(e) => update('footer', e.currentTarget.value)} placeholder="e.g., Closes #123, Breaking change info"></textarea>
8684
</div>
8785

8886
<style>
@@ -118,4 +116,39 @@
118116
.add-flag-button:hover {
119117
background-color: var(--vscode-button-secondaryHoverBackground);
120118
}
119+
120+
input[type='checkbox'] {
121+
appearance: none;
122+
-webkit-appearance: none;
123+
width: 16px;
124+
height: 16px;
125+
border: 1px solid var(--vscode-input-border);
126+
border-radius: 3px;
127+
background-color: var(--vscode-input-background);
128+
cursor: pointer;
129+
position: relative;
130+
transition: background-color 0.15s ease-in-out;
131+
}
132+
133+
input[type='checkbox']:checked {
134+
background-color: var(--vscode-button-background);
135+
border-color: var(--vscode-button-background);
136+
}
137+
138+
input[type='checkbox']:checked::after {
139+
content: '';
140+
position: absolute;
141+
top: 2px;
142+
left: 5px;
143+
width: 4px;
144+
height: 8px;
145+
border: solid var(--vscode-button-foreground);
146+
border-width: 0 2px 2px 0;
147+
transform: rotate(45deg);
148+
}
149+
150+
input[type='checkbox']:focus {
151+
outline: 1px solid var(--vscode-focusBorder);
152+
outline-offset: 1px;
153+
}
121154
</style>

0 commit comments

Comments
 (0)