-
Notifications
You must be signed in to change notification settings - Fork 839
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Emotion] Convert
EuiResizableCollapseButton
(#7091)
- Loading branch information
Showing
9 changed files
with
280 additions
and
169 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
This file was deleted.
Oops, something went wrong.
145 changes: 0 additions & 145 deletions
145
src/components/resizable_container/_resizable_collapse_button.scss
This file was deleted.
Oops, something went wrong.
97 changes: 97 additions & 0 deletions
97
src/components/resizable_container/resizable_collapse_button.stories.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,97 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { EuiPanel } from '../panel'; | ||
import { EuiResizableContainer } from './resizable_container'; | ||
import { | ||
EuiResizableCollapseButton, | ||
EuiResizableCollapseButtonProps, | ||
} from './resizable_collapse_button'; | ||
|
||
const meta: Meta<EuiResizableCollapseButtonProps> = { | ||
title: 'EuiResizableCollapseButton', | ||
component: EuiResizableCollapseButton, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiResizableCollapseButtonProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
direction: 'horizontal', | ||
externalPosition: 'before', | ||
internalPosition: 'middle', | ||
isVisible: true, | ||
isCollapsed: false, | ||
}, | ||
render: ({ isCollapsed, direction, ...args }) => ( | ||
<EuiPanel | ||
paddingSize="none" | ||
css={({ euiTheme: { size } }) => ({ | ||
position: 'relative', | ||
inlineSize: isCollapsed && direction === 'horizontal' ? size.l : 200, | ||
blockSize: isCollapsed && direction === 'vertical' ? size.l : 200, | ||
})} | ||
> | ||
<EuiResizableCollapseButton | ||
isCollapsed={isCollapsed} | ||
direction={direction} | ||
{...args} | ||
/> | ||
</EuiPanel> | ||
), | ||
}; | ||
|
||
export const ProductionUsage: Story = { | ||
args: { | ||
direction: 'horizontal', | ||
internalPosition: 'middle', | ||
}, | ||
argTypes: { | ||
// Not testable via `EuiResizableContainer`, so hide these props from the controls | ||
externalPosition: { table: { disable: true } }, | ||
isVisible: { table: { disable: true } }, | ||
isCollapsed: { table: { disable: true } }, | ||
}, | ||
render: ({ direction, internalPosition }) => ( | ||
<EuiResizableContainer direction={direction} css={{ blockSize: 500 }}> | ||
{(EuiResizablePanel, EuiResizableButton) => ( | ||
<> | ||
<EuiResizablePanel | ||
mode={['collapsible', { position: internalPosition }]} | ||
initialSize={20} | ||
minSize="10%" | ||
> | ||
<span>Lorem ipsum dolor sit amet</span> | ||
</EuiResizablePanel> | ||
|
||
<EuiResizableButton /> | ||
|
||
<EuiResizablePanel mode="main" initialSize={60} minSize="100px"> | ||
<EuiPanel css={{ blockSize: '100%' }}> | ||
Lorem ipsum dolor sit amet | ||
</EuiPanel> | ||
</EuiResizablePanel> | ||
|
||
<EuiResizableButton /> | ||
|
||
<EuiResizablePanel | ||
mode={['collapsible', { position: internalPosition }]} | ||
initialSize={20} | ||
minSize="10%" | ||
> | ||
<span>Lorem ipsum dolor sit amet</span> | ||
</EuiResizablePanel> | ||
</> | ||
)} | ||
</EuiResizableContainer> | ||
), | ||
}; |
Oops, something went wrong.