This is an automated email from the ASF dual-hosted git repository.
rstrickland pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil-vscode.git
The following commit(s) were added to refs/heads/main by this push:
new dadddb8 Fix Button Collapse Bug
dadddb8 is described below
commit dadddb86c515017771c0c3159ef73b1b8b430676
Author: Robert Strickland <[email protected]>
AuthorDate: Tue Aug 15 09:10:44 2023 -0500
Fix Button Collapse Bug
- Fixes an issue where the button collapse determination was entering an
"impossible" state.
Closes #761
---
src/svelte/src/components/Inputs/Buttons/Button.svelte | 5 +++--
src/svelte/src/utilities/display.ts | 6 ++++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/svelte/src/components/Inputs/Buttons/Button.svelte
b/src/svelte/src/components/Inputs/Buttons/Button.svelte
index 1b624d6..29d1cf7 100644
--- a/src/svelte/src/components/Inputs/Buttons/Button.svelte
+++ b/src/svelte/src/components/Inputs/Buttons/Button.svelte
@@ -20,12 +20,13 @@ limitations under the License.
import { onMount } from 'svelte'
import { UIThemeCSSClass } from '../../../utilities/colorScheme'
import { tooltipsEnabled } from '../../../stores'
+ import { shouldCollapseContent } from '../../../utilities/display'
export let fn: (event?: Event) => void
export let disabledBy = false
export let width = ''
onMount(() => {
- collapseContent = document.body.clientWidth <= 1600
+ collapseContent = shouldCollapseContent()
})
export let description = ''
@@ -38,7 +39,7 @@ limitations under the License.
window.addEventListener('resize', () => {
clearTimeout(collapseContentFn)
collapseContentFn = setTimeout(() => {
- collapseContent = document.body.clientWidth <= 1500
+ collapseContent = shouldCollapseContent()
}, 100)
})
</script>
diff --git a/src/svelte/src/utilities/display.ts
b/src/svelte/src/utilities/display.ts
index 939b447..a9edc4b 100644
--- a/src/svelte/src/utilities/display.ts
+++ b/src/svelte/src/utilities/display.ts
@@ -208,3 +208,9 @@ export function humanReadableByteLength(byteLength:
number): string {
return ret
}
+
+export const CLIENT_WIDTH_COLLAPSE_THRESHOLD = 1500
+
+export function shouldCollapseContent(): boolean {
+ return document.body.clientWidth <= CLIENT_WIDTH_COLLAPSE_THRESHOLD
+}