Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add size hint, fix #329 #336

Merged
merged 10 commits into from Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -6,6 +6,7 @@ import HatchedPattern from '../misc/HatchedPattern.vue'
import CheckerboardPattern from '../misc/CheckerboardPattern.vue'
import { usePreviewSettingsStore } from '../../stores/preview-settings'
import { Variant } from '../../types'
import { VTooltip as vTooltip } from 'floating-vue'

const props = defineProps<{
variant: Variant
Expand Down Expand Up @@ -115,6 +116,8 @@ const finalHeight = computed(() => settings.rotate ? settings.responsiveWidth :
// Disabled responsive

const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled)

const sizeTooltip = computed(() => (responsiveWidth.value ?? 'Auto') + ' × ' + (responsiveHeight.value ?? 'Auto'))
</script>

<template>
Expand Down Expand Up @@ -174,6 +177,7 @@ const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled)
<template v-if="isResponsiveEnabled">
<div
ref="horizontalDragger"
v-tooltip.right="sizeTooltip"
class="htw-absolute htw-w-4 htw-top-0 htw-bottom-4 htw-right-0 hover:htw-bg-primary-500/30 htw-flex htw-items-center htw-justify-center htw-cursor-ew-resize htw-group hover:htw-text-primary-500"
>
<Icon
Expand All @@ -183,6 +187,7 @@ const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled)
</div>
<div
ref="verticalDragger"
v-tooltip.bottom="sizeTooltip"
class="htw-absolute htw-h-4 htw-left-0 htw-right-4 htw-bottom-0 hover:htw-bg-primary-500/30 htw-flex htw-items-center htw-justify-center htw-cursor-ns-resize htw-group hover:htw-text-primary-500"
>
<Icon
Expand All @@ -192,6 +197,7 @@ const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled)
</div>
<div
ref="cornerDragger"
v-tooltip.bottom="sizeTooltip"
class="htw-absolute htw-w-4 htw-h-4 htw-right-0 htw-bottom-0 hover:htw-bg-primary-500/30 htw-flex htw-items-center htw-justify-center htw-cursor-nwse-resize htw-group hover:htw-text-primary-500"
/>
</template>
Expand Down
Expand Up @@ -38,7 +38,7 @@ const settings = usePreviewSettingsStore().currentSettings
Rotate
</BaseCheckbox>

<div class="htw-flex htw-gap-2 htw-px-4 htw-py-3">
<div class="htw-flex htw-items-center htw-gap-2 htw-px-4 htw-py-3">
<input
v-model.number="settings.responsiveWidth"
v-tooltip="'Responsive width (px)'"
Expand All @@ -47,7 +47,7 @@ const settings = usePreviewSettingsStore().currentSettings
step="16"
placeholder="Auto"
>
<span class="htw-opacity-50">x</span>
<span class="htw-opacity-50">×</span>
<input
v-model.number="settings.responsiveHeight"
v-tooltip="'Responsive height (px)'"
Expand Down