Skip to content

Commit d06081a

Browse files
moninlaJustineo
authored andcommitted
refactor: make panelPosition.width required and use assignment instead of delete
1 parent 5c83009 commit d06081a

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

components/Panel.vue

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ const { x, y, isDragging } = useDraggable(panel, {
3131
3232
const { width: windowWidth, height: windowHeight } = useWindowSize()
3333
34-
const panelWidth = ref(position?.width ?? ui.tempadPanelWidth)
34+
const panelWidth = ref(position ? position.width : ui.tempadPanelWidth)
3535
const isResizing = ref(false)
3636
37-
// no need reactive state, directly using variables
3837
let resizeState: {
3938
direction: 'left' | 'right'
4039
startX: number
@@ -104,7 +103,7 @@ function endResize(e: PointerEvent) {
104103
function resetWidth() {
105104
panelWidth.value = ui.tempadPanelWidth
106105
if (position) {
107-
delete position.width
106+
position.width = ui.tempadPanelWidth
108107
}
109108
}
110109
@@ -233,7 +232,7 @@ const resizingCursor = 'ew-resize'
233232
top: 0;
234233
bottom: 0;
235234
width: 8px;
236-
z-index: 100;
235+
z-index: 10;
237236
transition: background-color 0.2s ease;
238237
touch-action: none;
239238
user-select: none;
@@ -266,9 +265,8 @@ const resizingCursor = 'ew-resize'
266265
267266
.tp-panel-main {
268267
flex: 1 1 auto;
269-
/* TODO: find correct way to inject this radius value */
270-
border-bottom-left-radius: var(--radius-lg, 0.8125rem);
271-
border-bottom-right-radius: var(--radius-lg, 0.8125rem);
268+
border-bottom-left-radius: 0.8125rem;
269+
border-bottom-right-radius: 0.8125rem;
272270
}
273271
274272
.tp-panel-header-icon {

ui/state.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export type Options = {
1515
panelPosition: {
1616
left: number
1717
top: number
18-
width?: number
18+
width: number
1919
}
2020
prefOpen: boolean
2121
deepSelectOn: boolean
@@ -34,7 +34,8 @@ export const options = useStorage<Options>('tempad-dev', {
3434
minimized: false,
3535
panelPosition: {
3636
left: window.innerWidth - ui.nativePanelWidth - ui.tempadPanelWidth,
37-
top: ui.topBoundary
37+
top: ui.topBoundary,
38+
width: ui.tempadPanelWidth
3839
},
3940
prefOpen: false,
4041
deepSelectOn: false,

0 commit comments

Comments
 (0)