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

Fix sorting key ui pick order #2201

Merged
merged 1 commit into from
Oct 29, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 8 additions & 24 deletions ui/app/mirrors/create/cdc/sortingkey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ import { Label } from '@/lib/Label';
import { RowWithCheckbox } from '@/lib/Layout';
import { ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import { engineOptionStyles } from './styles';
import {
engineOptionStyles,
sortingKeyPillContainerStyle,
sortingKeyPillStyle,
} from './styles';

interface SortingKeysProps {
columns: string[];
Expand All @@ -42,7 +46,7 @@ const SelectSortingKeys = ({
(col: string, action: 'add' | 'remove') => {
setSortingKeysSelections((prev) => {
if (action === 'add' && !prev.some((key) => key === col)) {
return [col, ...prev];
return [...prev, col];
} else if (action === 'remove') {
return prev.filter((prevCol) => prevCol !== col);
}
Expand Down Expand Up @@ -147,30 +151,10 @@ const SelectSortingKeys = ({
theme={SelectTheme}
isClearable
/>
<div
style={{
display: 'flex',
marginTop: '0.5rem',
columnGap: '0.5rem',
rowGap: '0.5rem',
alignItems: 'center',
flexWrap: 'wrap',
}}
>
<div style={sortingKeyPillContainerStyle}>
{sortingKeysSelections.map((col: string) => {
return (
<div
key={col}
style={{
display: 'flex',
columnGap: '0.3rem',
alignItems: 'center',
border: '1px solid #e5e7eb',
borderRadius: '1rem',
paddingLeft: '0.5rem',
paddingRight: '0.5rem',
}}
>
<div key={col} style={sortingKeyPillStyle}>
<p style={{ fontSize: '0.7rem' }}>{col}</p>
<Button
variant='normalBorderless'
Expand Down
19 changes: 19 additions & 0 deletions ui/app/mirrors/create/cdc/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,25 @@ export const columnBoxDividerStyle: CSSProperties = {
opacity: 0.5,
};

export const sortingKeyPillStyle: CSSProperties = {
display: 'flex',
columnGap: '0.3rem',
alignItems: 'center',
border: '1px solid #e5e7eb',
borderRadius: '1rem',
paddingLeft: '0.5rem',
paddingRight: '0.5rem',
};

export const sortingKeyPillContainerStyle: CSSProperties = {
display: 'flex',
marginTop: '0.5rem',
columnGap: '0.5rem',
rowGap: '0.5rem',
alignItems: 'center',
flexWrap: 'wrap',
};

const targetHeight = 30;

export const engineOptionStyles = {
Expand Down
Loading