import React, { Component } from 'react'; import { hot } from 'react-hot-loader/root'; import Button from 'react-bootstrap/Button'; import Form from 'react-bootstrap/Form'; import { BsX } from 'react-icons/bs'; import styled from 'styled-components'; import Dock from '../../src/Dock'; const Root = styled.div` font-size: 16px; color: #999; height: 100vh; `; const Main = styled.div` width: 100%; height: 150%; display: flex; flex-direction: column; align-items: center; padding-top: 30vh; `; const DockContent = styled.div` width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column; `; const Remove = styled(BsX)` position: absolute; z-index: 1; right: 10px; top: 10px; cursor: pointer; `; const positions = ['left', 'top', 'right', 'bottom']; const dimModes = ['transparent', 'none', 'opaque']; class App extends Component { constructor(props) { super(props); this.state = { positionIdx: 0, dimModeIdx: 0, isVisible: true, fluid: true, customAnimation: false, slow: false, size: 0.25, }; } componentDidMount() {} render() { const duration = this.state.slow ? 2000 : 200; const dur = duration / 1000; const transitions = ['left', 'top', 'width', 'height'] .map((p) => `${p} ${dur}s cubic-bezier(0, 1.5, 0.5, 1)`) .join(','); return (

Main Content

Position: {positions[this.state.positionIdx]}
Dim Mode: {dimModes[this.state.dimModeIdx]}
this.setState({ isVisible: !this.state.isVisible, }) } /> this.setState({ customAnimation: !this.state.customAnimation, }) } /> this.setState({ slow: !this.state.slow, }) } /> this.setState({ fluid: !this.state.fluid, }) } />
{({ position, isResizing }) => (

Dock Content

Position: {position}
Resizing: {isResizing ? 'true' : 'false'}
this.setState({ isVisible: false })} />
)}
); } handleVisibleChange = (isVisible) => { this.setState({ isVisible }); }; handleSizeChange = (size) => { this.setState({ size }); }; handlePositionClick = () => { this.setState({ positionIdx: (this.state.positionIdx + 1) % 4 }); }; handleDimModeClick = () => { this.setState({ dimModeIdx: (this.state.dimModeIdx + 1) % 3 }); }; } export default hot(App);