IntegrationsInstructionsModal.tsx 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. import React, { Component } from "react";
  2. import styled from "styled-components";
  3. import close from "assets/close.png";
  4. import TabSelector from "components/TabSelector";
  5. import { Context } from "shared/Context";
  6. type PropsType = {};
  7. type StateType = {
  8. currentTab: string;
  9. currentPage: number;
  10. };
  11. const tabOptions = [{ label: "MacOS", value: "mac" }];
  12. export default class ClusterInstructionsModal extends Component<
  13. PropsType,
  14. StateType
  15. > {
  16. state = {
  17. currentTab: "mac",
  18. currentPage: 0
  19. };
  20. renderPage = () => {
  21. switch (this.state.currentPage) {
  22. case 0:
  23. return (
  24. <Placeholder>
  25. <Bold>Elastic Container Registry (ECR):</Bold>
  26. 1. Run the following command on the Porter CLI.
  27. <Code>porter connect ecr</Code>
  28. 2. Enter the region your ECR instance belongs to. For example:
  29. <Code>AWS Region: us-west-2</Code>
  30. 3. Porter will automatically set up an IAM user in your AWS account
  31. to grant ECR access. Once this is done, it will prompt you to enter
  32. a name for the registry. Here you may enter any name you'd like.
  33. <Code>Give this registry a name: my-awesome-registry</Code>
  34. </Placeholder>
  35. );
  36. default:
  37. return;
  38. }
  39. };
  40. render() {
  41. let { currentPage, currentTab } = this.state;
  42. return (
  43. <StyledClusterInstructionsModal>
  44. <CloseButton
  45. onClick={() => {
  46. this.context.setCurrentModal(null, null);
  47. }}
  48. >
  49. <CloseButtonImg src={close} />
  50. </CloseButton>
  51. <ModalTitle>Connecting to an Image Registry</ModalTitle>
  52. <TabSelector
  53. options={tabOptions}
  54. currentTab={currentTab}
  55. setCurrentTab={(value: string) =>
  56. this.setState({ currentTab: value })
  57. }
  58. />
  59. {this.renderPage()}
  60. </StyledClusterInstructionsModal>
  61. );
  62. }
  63. }
  64. ClusterInstructionsModal.contextType = Context;
  65. const PageCount = styled.div`
  66. margin-right: 9px;
  67. user-select: none;
  68. letter-spacing: 2px;
  69. `;
  70. const PageSection = styled.div`
  71. position: absolute;
  72. bottom: 22px;
  73. right: 20px;
  74. display: flex;
  75. align-items: center;
  76. font-size: 13px;
  77. color: #ffffff;
  78. justify-content: flex-end;
  79. user-select: none;
  80. > i {
  81. font-size: 18px;
  82. margin-left: 2px;
  83. cursor: pointer;
  84. border-radius: 20px;
  85. padding: 5px;
  86. :hover {
  87. background: #ffffff11;
  88. }
  89. }
  90. `;
  91. const Code = styled.div`
  92. background: #181b21;
  93. padding: 10px 15px;
  94. border: 1px solid #ffffff44;
  95. border-radius: 5px;
  96. margin: 10px 0px 15px;
  97. color: #ffffff;
  98. font-size: 13px;
  99. user-select: text;
  100. line-height: 1em;
  101. font-family: monospace;
  102. `;
  103. const A = styled.a`
  104. color: #ffffff;
  105. text-decoration: underline;
  106. cursor: ${(props: { disabled?: boolean }) =>
  107. props.disabled ? "not-allowed" : "pointer"};
  108. `;
  109. const Placeholder = styled.div`
  110. color: #aaaabb;
  111. font-size: 13px;
  112. margin-left: 0px;
  113. margin-top: 25px;
  114. line-height: 1.6em;
  115. user-select: none;
  116. `;
  117. const Bold = styled.div`
  118. font-weight: 600;
  119. margin-bottom: 7px;
  120. `;
  121. const Subtitle = styled.div`
  122. padding: 10px 0px 20px;
  123. font-family: "Work Sans", sans-serif;
  124. font-size: 13px;
  125. color: #aaaabb;
  126. margin-top: 3px;
  127. overflow: hidden;
  128. white-space: nowrap;
  129. text-overflow: ellipsis;
  130. `;
  131. const ModalTitle = styled.div`
  132. margin: 0px 0px 13px;
  133. display: flex;
  134. flex: 1;
  135. font-family: "Assistant";
  136. font-size: 18px;
  137. color: #ffffff;
  138. user-select: none;
  139. font-weight: 700;
  140. align-items: center;
  141. position: relative;
  142. white-space: nowrap;
  143. text-overflow: ellipsis;
  144. `;
  145. const CloseButton = styled.div`
  146. position: absolute;
  147. display: block;
  148. width: 40px;
  149. height: 40px;
  150. padding: 13px 0 12px 0;
  151. z-index: 1;
  152. text-align: center;
  153. border-radius: 50%;
  154. right: 15px;
  155. top: 12px;
  156. cursor: pointer;
  157. :hover {
  158. background-color: #ffffff11;
  159. }
  160. `;
  161. const CloseButtonImg = styled.img`
  162. width: 14px;
  163. margin: 0 auto;
  164. `;
  165. const StyledClusterInstructionsModal = styled.div`
  166. width: 100%;
  167. position: absolute;
  168. left: 0;
  169. top: 0;
  170. height: 100%;
  171. padding: 25px 32px;
  172. overflow: hidden;
  173. border-radius: 6px;
  174. background: #202227;
  175. `;