make dropzone for available items bigger

This commit is contained in:
Nate Kelley 2025-04-11 14:00:47 -06:00
parent 1efc0653d4
commit f32d88a206
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
8 changed files with 39 additions and 35 deletions

View File

@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { Text } from '@/components/ui/typography'; import { Text } from '@/components/ui/typography';
import { cn } from '@/lib/classMerge';
interface StylingLabelProps { interface StylingLabelProps {
label: string; label: string;
@ -12,7 +13,7 @@ interface StylingLabelProps {
export const StylingLabel = React.forwardRef<HTMLDivElement, StylingLabelProps>( export const StylingLabel = React.forwardRef<HTMLDivElement, StylingLabelProps>(
({ label, labelExtra, children, className = '', id }, ref) => { ({ label, labelExtra, children, className = '', id }, ref) => {
return ( return (
<div className={`flex flex-col space-y-2.5 ${className}`} ref={ref} id={id}> <div className={cn('flex flex-col space-y-2.5', className)} ref={ref} id={id}>
<div className="flex h-6 items-center justify-between"> <div className="flex h-6 items-center justify-between">
<Text size="sm" variant="secondary"> <Text size="sm" variant="secondary">
{label} {label}

View File

@ -96,8 +96,10 @@ export const MetricStylingApp: React.FC<{
setSegment={setSegment} setSegment={setSegment}
selectedChartType={selectedChartType} selectedChartType={selectedChartType}
/> />
{
<ScrollArea className=""> //this crazy css selector is so that the available section has a large dropzone
}
<ScrollArea className="h-full [&>div>div]:h-full!">
{segment === MetricStylingAppSegments.VISUALIZE && ( {segment === MetricStylingAppSegments.VISUALIZE && (
<StylingAppVisualize <StylingAppVisualize
className="px-4 pt-3" className="px-4 pt-3"

View File

@ -32,7 +32,7 @@ import { StylingAppStylingNotSupported } from './StylingAppStylingNotSupported';
import { EditScatterDotSize } from './EditScatterDotSize'; import { EditScatterDotSize } from './EditScatterDotSize';
import { useUpdateMetricChart } from '@/context/Metrics'; import { useUpdateMetricChart } from '@/context/Metrics';
const sectionClass = 'flex w-full flex-col space-y-3 my-3 '; const sectionClass = 'flex w-full flex-col space-y-3 my-3';
const UNSUPPORTED_CHART_TYPES: ChartType[] = [ChartType.Table, ChartType.Metric]; const UNSUPPORTED_CHART_TYPES: ChartType[] = [ChartType.Table, ChartType.Metric];
export const StylingAppStyling: React.FC<{ export const StylingAppStyling: React.FC<{

View File

@ -59,15 +59,13 @@ export const SelectAxis: React.FC<
} }
return ( return (
<div id="select-axis-container"> <SelectAxisProvider
<SelectAxisProvider {...props}
{...props} selectedAxis={selectedAxis}
selectedAxis={selectedAxis} selectedChartType={selectedChartType}
selectedChartType={selectedChartType} columnMetadata={columnMetadata}>
columnMetadata={columnMetadata}> <SelectAxisDropzones items={items} dropZones={dropZones} onChange={onChange} />
<SelectAxisDropzones items={items} dropZones={dropZones} onChange={onChange} /> </SelectAxisProvider>
</SelectAxisProvider>
</div>
); );
}); });
SelectAxis.displayName = 'SelectAxis'; SelectAxis.displayName = 'SelectAxis';

View File

@ -257,7 +257,7 @@ const ColumnSettingComponent: React.FC<{
return ( return (
<> <>
<div className={`${className} flex w-full flex-col space-y-3 overflow-hidden p-3`}> <div className={`${className} swag2 flex w-full flex-col space-y-3 overflow-hidden p-3`}>
{EnabledComponentsLoop.map(({ enabled, key, Component }) => { {EnabledComponentsLoop.map(({ enabled, key, Component }) => {
return <React.Fragment key={key}>{Component}</React.Fragment>; return <React.Fragment key={key}>{Component}</React.Fragment>;
})} })}
@ -429,7 +429,7 @@ const LabelSettings: React.FC<{
return ( return (
<ErrorBoundary> <ErrorBoundary>
<div className={`${className} flex w-full flex-col space-y-3 overflow-hidden p-3`}> <div className={`${className} swag flex w-full flex-col space-y-3 overflow-hidden p-3`}>
{ComponentsLoop.map(({ key, Component }) => { {ComponentsLoop.map(({ key, Component }) => {
return <React.Fragment key={key}>{Component}</React.Fragment>; return <React.Fragment key={key}>{Component}</React.Fragment>;
})} })}

View File

@ -28,22 +28,24 @@ export const AvailableItemsList: React.FC<AvailableItemsListProps> = ({
(isOver || isActive) && activeZone !== SelectAxisContainerId.Available; (isOver || isActive) && activeZone !== SelectAxisContainerId.Available;
return ( return (
<div ref={setNodeRef}> <StylingLabel
<StylingLabel id="available-items-list" label="Available"> id="available-items-list"
<div label="Available"
className={cn( className="mb-4 h-full"
'mb-1', ref={setNodeRef}>
showDeleteHoverState ? 'rounded bg-red-100 shadow-[0_0_3px_1px] shadow-red-300' : '' <div
)}> className={cn(
{items.map((item) => ( 'mb-1',
<SelectAxisSortableItem showDeleteHoverState ? 'rounded bg-red-100 shadow-[0_0_3px_1px] shadow-red-300' : ''
key={item.id} )}>
item={item} {items.map((item) => (
zoneId={SelectAxisContainerId.Available} <SelectAxisSortableItem
/> key={item.id}
))} item={item}
</div> zoneId={SelectAxisContainerId.Available}
</StylingLabel> />
</div> ))}
</div>
</StylingLabel>
); );
}; };

View File

@ -53,7 +53,7 @@ export const SelectAxisDropzones: React.FC<{
onDragStart={handleDragStart} onDragStart={handleDragStart}
onDragOver={handleDragOver} onDragOver={handleDragOver}
onDragEnd={handleDragEnd}> onDragEnd={handleDragEnd}>
<div className="flex flex-col gap-4"> <div className="mb-2 flex h-full flex-col gap-4">
{dropZones.map((zone) => ( {dropZones.map((zone) => (
<SelectAxisDropZone <SelectAxisDropZone
key={zone.id} key={zone.id}

View File

@ -14,6 +14,7 @@ import {
import { ISelectAxisContext } from './SelectAxis/useSelectAxisContext'; import { ISelectAxisContext } from './SelectAxis/useSelectAxisContext';
import { StylingMetric } from './StylingMetric'; import { StylingMetric } from './StylingMetric';
import { useMount, useUnmount } from '@/hooks'; import { useMount, useUnmount } from '@/hooks';
import { cn } from '@/lib/classMerge';
export const StylingAppVisualize: React.FC< export const StylingAppVisualize: React.FC<
{ {
@ -47,7 +48,7 @@ export const StylingAppVisualize: React.FC<
const isMetricChart = selectedChartType === ChartType.Metric; const isMetricChart = selectedChartType === ChartType.Metric;
return ( return (
<div className={`flex w-full flex-col space-y-3`}> <div className={`flex h-full w-full flex-col space-y-3`}>
<div className={className}> <div className={className}>
<StylingLabel label="Chart type"> <StylingLabel label="Chart type">
<SelectChartType <SelectChartType
@ -64,7 +65,7 @@ export const StylingAppVisualize: React.FC<
</div> </div>
{!isMetricChart && ( {!isMetricChart && (
<div className={className}> <div className={cn(className, 'h-full')}>
<SelectAxis {...props} /> <SelectAxis {...props} />
</div> </div>
)} )}