You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 5.0 KiB

4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /**
  2. * Copyright (c) 2017-present, Facebook, Inc.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. const React = require('react');
  8. const CompLibrary = require('../../core/CompLibrary.js');
  9. const MarkdownBlock = CompLibrary.MarkdownBlock; /* Used to read markdown */
  10. const Container = CompLibrary.Container;
  11. const GridBlock = CompLibrary.GridBlock;
  12. class HomeSplash extends React.Component {
  13. render() {
  14. const {siteConfig, language = ''} = this.props;
  15. const {baseUrl, docsUrl} = siteConfig;
  16. const docsPart = `${docsUrl ? `${docsUrl}/` : ''}`;
  17. const langPart = `${language ? `${language}/` : ''}`;
  18. const docUrl = doc => `${baseUrl}${docsPart}${langPart}${doc}`;
  19. const SplashContainer = props => (
  20. <div className="homeContainer">
  21. <div className="homeSplashFade">
  22. <div className="wrapper homeWrapper">{props.children}</div>
  23. </div>
  24. </div>
  25. );
  26. const Logo = props => (
  27. <div className="projectLogo">
  28. <img src={props.img_src} alt="Project Logo" />
  29. </div>
  30. );
  31. const ProjectTitle = props => (
  32. <h2 className="projectTitle">
  33. {props.title}
  34. <small>{props.tagline}</small>
  35. </h2>
  36. );
  37. const PromoSection = props => (
  38. <div className="section promoSection">
  39. <div className="promoRow">
  40. <div className="pluginRowBlock">{props.children}</div>
  41. </div>
  42. </div>
  43. );
  44. const Button = props => (
  45. <div className="pluginWrapper buttonWrapper">
  46. <a className="button" href={props.href} target={props.target}>
  47. {props.children}
  48. </a>
  49. </div>
  50. );
  51. return (
  52. <SplashContainer>
  53. <Logo img_src={`${baseUrl}img/diagrams.png`} />
  54. <div className="inner">
  55. <ProjectTitle tagline={siteConfig.tagline} title={siteConfig.title} />
  56. <PromoSection>
  57. <Button href={docUrl('getting-started/installation')}>Try It Out</Button>
  58. <Button href={docUrl('getting-started/examples')}>Show Examples</Button>
  59. </PromoSection>
  60. </div>
  61. </SplashContainer>
  62. );
  63. }
  64. }
  65. class Index extends React.Component {
  66. render() {
  67. const {config: siteConfig, language = ''} = this.props;
  68. const {baseUrl} = siteConfig;
  69. const Block = props => (
  70. <Container
  71. padding={['bottom', 'top']}
  72. id={props.id}
  73. background={props.background}>
  74. <GridBlock
  75. align="center"
  76. contents={props.children}
  77. layout={props.layout}
  78. />
  79. </Container>
  80. );
  81. const About = () => (
  82. <div
  83. className="productShowcaseSection paddingBottom"
  84. style={{textAlign: 'center'}}>
  85. <h2>About Diagrams</h2>
  86. <MarkdownBlock>
  87. Diagrams lets you draw the cloud system architecture **in Python code**.
  88. </MarkdownBlock>
  89. <MarkdownBlock>
  90. It was born for **prototyping** a new system architecture without any design tools. You can also describe or visualize the existing system architecture as well.
  91. </MarkdownBlock>
  92. <MarkdownBlock>
  93. `Diagram as Code` allows you to **track** the architecture diagram changes in any **version control** system.
  94. </MarkdownBlock>
  95. <MarkdownBlock>
  96. Diagrams currently supports six major providers: `AWS`, `Azure`, `GCP`, `Kubernetes`, `Alibaba Cloud` and `Oracle Cloud`. It now also supports `On-Premise` nodes as well as `Programming Languages` and `Frameworks`.
  97. </MarkdownBlock>
  98. </div>
  99. );
  100. const Sponsorship = () => (
  101. <div
  102. className="productShowcaseSection paddingBottom"
  103. style={{textAlign: 'center'}}>
  104. <h2>Sponsorship</h2>
  105. <MarkdownBlock>
  106. Sponsoring always helps a lot to maintain Diagrams. Thank you :)
  107. </MarkdownBlock>
  108. <a href="https://www.buymeacoffee.com/mingrammer" target="_blank">
  109. <img id="buymeacoffee" src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee"/>
  110. </a>
  111. </div>
  112. );
  113. const Example = () => (
  114. <Block>
  115. {[
  116. {
  117. image: `${baseUrl}img/message_collecting_code.png`,
  118. imageAlign: 'left',
  119. },
  120. {
  121. image: `${baseUrl}img/message_collecting_diagram.png`,
  122. imageAlign: 'right',
  123. },
  124. ]}
  125. </Block>
  126. );
  127. const Example2 = () => (
  128. <Block>
  129. {[
  130. {
  131. image: `${baseUrl}img/event_processing_code.png`,
  132. imageAlign: 'left',
  133. },
  134. {
  135. image: `${baseUrl}img/event_processing_diagram.png`,
  136. imageAlign: 'right',
  137. },
  138. ]}
  139. </Block>
  140. );
  141. return (
  142. <div>
  143. <HomeSplash siteConfig={siteConfig} language={language} />
  144. <div className="mainContainer">
  145. <About />
  146. <Example />
  147. <Example2 />
  148. <Sponsorship />
  149. </div>
  150. </div>
  151. );
  152. }
  153. }
  154. module.exports = Index;