-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated to new splitter * Got local split working with emotion * Moved to NPM package * Fix include * PR fixes * Remove old props * Add reset on double click * PR fixes
- Loading branch information
1 parent
609e736
commit bb3a8ef
Showing
8 changed files
with
237 additions
and
525 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
257 changes: 0 additions & 257 deletions
257
Composer/packages/client/src/components/Split/LeftRightSplit.tsx
This file was deleted.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
Composer/packages/client/src/components/Split/ThinSplitter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import * as React from 'react'; | ||
import styled from '@emotion/styled'; | ||
import { RenderSplitterProps } from '@geoffcox/react-splitter'; | ||
|
||
const splitVisualClassName = 'thin-split-visual'; | ||
|
||
const HitArea = styled.div(({ horizontal, dragging }: { horizontal: boolean; dragging: boolean }) => ({ | ||
boxSizing: 'border-box', | ||
outline: 'none', | ||
overflow: 'hidden', | ||
height: '100%', | ||
width: '100%', | ||
cursor: horizontal ? 'row-resize' : 'col-resize', | ||
background: 'transparent', | ||
[`&:hover .${splitVisualClassName}`]: { | ||
background: dragging ? 'black' : 'gray', | ||
}, | ||
userSelect: 'none', | ||
})); | ||
|
||
const getCenteredMargin = (size: number) => `${Math.max(0, Math.floor(size / 2) - 1)}px`; | ||
|
||
const Splitter = styled.div( | ||
({ horizontal, splitterSize, dragging }: { horizontal: boolean; splitterSize: number; dragging: boolean }) => ({ | ||
boxSizing: 'border-box', | ||
outline: 'none', | ||
overflow: 'hidden', | ||
height: horizontal ? '1px' : '100%', | ||
width: horizontal ? '100%' : '1px', | ||
marginLeft: horizontal ? '0' : getCenteredMargin(splitterSize), | ||
marginTop: horizontal ? getCenteredMargin(splitterSize) : '0', | ||
background: dragging ? 'black' : 'silver', | ||
}) | ||
); | ||
|
||
/** | ||
* The default splitter which provides a thin line within a possibly larger mouse hit area. | ||
* @param props | ||
*/ | ||
export const ThinSplitter = (props: RenderSplitterProps) => { | ||
const { horizontal, pixelSize, dragging } = props; | ||
|
||
return ( | ||
<HitArea dragging={dragging} horizontal={horizontal}> | ||
<Splitter className={splitVisualClassName} dragging={dragging} horizontal={horizontal} splitterSize={pixelSize} /> | ||
</HitArea> | ||
); | ||
}; | ||
|
||
export const renderThinSplitter = (props: RenderSplitterProps) => { | ||
return <ThinSplitter {...props} />; | ||
}; |
Oops, something went wrong.