Guest User

Untitled

a guest
Aug 17th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.53 KB | None | 0 0
  1. import * as React from 'react';
  2. import * as Radium from 'radium';
  3. import { styles } from './SidePanelStyles';
  4. import Drawer from 'material-ui/Drawer';
  5.  
  6. export interface SidePanelComponentProps {
  7. visible: boolean;
  8. children: JSX.Element;
  9. }
  10.  
  11. const backdrop = {
  12. height: '82%'
  13. };
  14.  
  15. const SidePanelComponent: React.SFC<SidePanelComponentProps> = (props: SidePanelComponentProps) => {
  16. const sidePanelWidth = window.innerWidth <= 600 ? '95%' : '50%';
  17. return (
  18. <Drawer open={props.visible} openSecondary={true} containerStyle={styles.drawer} width={sidePanelWidth} docked={false}>
  19. {props.children}
  20. </Drawer>
  21. );
  22. };
  23.  
  24. export const SidePanelView = Radium(SidePanelComponent);
  25.  
  26. export const styles: any = {
  27. drawer: {
  28. position: 'absolute',
  29. right: 0,
  30. top: 0,
  31. boxShadow: 0,
  32. borderRight: '2px solid #69CEFA',
  33. font: ' HelveticaNeue-Medium, Helvetica, Arial',
  34. lineHeight: '2rem',
  35. padding: '0 10px 10px 10px',
  36. }
  37. };
  38.  
  39. const styles: any = {
  40. wrapper: {
  41. padding: '2rem 2rem 1rem 2rem',
  42. position: 'relative',
  43. overflow: 'hidden',
  44. background: background,
  45. fontFamily: 'Helvetica Neue',
  46. //borderTop: '3px solid ' + green100,
  47. boxShadow: '2px 2px 10px 0px rgba(0,0,0,0.56)',
  48. borderRadius: 6,
  49. '@media only screen and (max-width : 600px)': {
  50. padding: '1rem'
  51. }
  52. },
  53. titleImageWrapper: {
  54. '@media only screen and (max-width : 600px)': {
  55. width: '100%',
  56. display: 'flex',
  57. alignItems: 'center',
  58. justifyContent: 'space-between',
  59. margin: '0.5rem 0 1rem 0'
  60. }
  61. },
  62. stepWrapper: {
  63. '@media only screen and (max-width : 600px)': {
  64. display: 'flex',
  65. height: '20px',
  66. alignItems: 'center',
  67. flexDirection: 'row-reverse',
  68. justifyContent: 'center',
  69. width: '100%',
  70. }
  71. },
  72. topWrapper: {
  73. display: 'flex',
  74. justifyContent: 'space-between',
  75. alignItems: 'center',
  76. '@media only screen and (max-width : 600px)': {
  77. flexDirection: 'column-reverse',
  78. }
  79. },
  80. titleWrapper: {
  81. textAlign: 'left',
  82. marginRight: '1rem'
  83. },
  84. contentWrapper: {
  85. display: 'flex',
  86. justifyContent: 'space-between',
  87. alignItems: 'center',
  88. },
  89. bottomRightContainer: {
  90. position: 'absolute',
  91. right: '5px',
  92. bottom: '5px'
  93. },
  94. mlogo: {
  95. width: '70px',
  96. '@media only screen and (max-width : 600px)': {
  97. }
  98. },
  99. hidden: {
  100. display: 'none'
  101. }
  102. };
  103.  
  104. return (
  105. <div style={styles.wrapper}>
  106. <div style={styles.topWrapper}>
  107. <div style={styles.titleImageWrapper}>
  108. {this.getTitle()}
  109. {(isImageVisible && mobileImage) && <img src={mobileImage} style={styles.mlogo}/>}
  110. </div>
  111. {isStepCountVisible(this.props.stage) &&
  112. <div style={styles.stepWrapper}>
  113. <StepCount selected={getStepIndex(this.props.stage)} steps={3}/>
  114. </div>
  115. }
  116. </div>
  117. <div style={styles.contentWrapper}>
  118. {this.state.windowWidth && this.state.windowWidth > 600 &&
  119. <CharityCardContainer onToggleSidePanel={this.handleOnToggleSidePanel.bind(this)}/>}
  120. <MainContentView
  121. stage={this.props.stage}
  122. charity={this.props.charity}
  123. onToggleSidePanel={(sidePanelContent: SidePanelContent) => this.handleOnToggleSidePanel(sidePanelContent)}
  124. updateStage={this.props.updateStage}
  125. />
  126. </div>
  127. <SidePanelView visible={isSidePanelOpen}>
  128. {this.getSidePanelContent()}
  129. </SidePanelView>
  130. </div>
  131. );
Add Comment
Please, Sign In to add comment