Skip to content

Commit

Permalink
refactor: improve Split's variables style
Browse files Browse the repository at this point in the history
  • Loading branch information
mortalYoung committed Feb 19, 2024
1 parent a7fda6f commit de01581
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 33 deletions.
5 changes: 0 additions & 5 deletions src/client/components/split/index.scss

This file was deleted.

7 changes: 3 additions & 4 deletions src/client/components/split/pane/index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@use '../index.scss' as variables;

$container: variables.$pane;
@import '../../../classNames/style.scss';
$container: prefix('pane');

.#{$container} {
height: 100%;
Expand All @@ -12,4 +11,4 @@ $container: variables.$pane;

:export {
pane: $container;
}
}
4 changes: 2 additions & 2 deletions src/client/components/split/sash/index.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@use '../index.scss' as split;
@import '../../../classNames/style.scss';

$container: split.$sash;
$container: prefix('sash');

$hover: BEMModifier($container, 'hover');
$disabled: BEMModifier($container, 'disabled');
$vertical: BEMModifier($container, 'vertical');
Expand Down
19 changes: 3 additions & 16 deletions src/client/components/split/splitPane/index.scss
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
@use '../index.scss' as variables;
@import '../../../classNames/style.scss';

$dragging: BEMModifier(variables.$split, 'dragging');
$vertical: BEMModifier(variables.$split, 'vertical');
$horizontal: BEMModifier(variables.$split, 'horizontal');
$split: prefix('split');

.#{variables.$split} {
.#{$split} {
height: 100%;
position: relative;
width: 100%;
overflow: hidden;

.#{$dragging} {
.#{variables.$pane} {
user-select: none;
pointer-events: none;
}
}
}

:export {
container: variables.$split;
dragging: $dragging;
vertical: $vertical;
horizontal: $horizontal;
container: $split;
}
7 changes: 1 addition & 6 deletions src/client/components/split/splitPane/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,7 @@ export const SplitPane = forwardRef<HTMLDivElement, ISplitProps>(function (
});

return (
<div
className={classNames(variables.container, resizing() && variables.dragging, variables[split], className)}
ref={forwarded}
title={title}
style={style}
>
<div className={classNames(variables.container, className)} ref={forwarded} title={title} style={style}>
{Boolean(sizes.length) &&
children.map((childNode, idx) => {
const sPosValue = sashPosSizes[idx] ?? 0;
Expand Down

0 comments on commit de01581

Please sign in to comment.