Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

ArticlePage.tsx 5.1 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
  1. import cx from 'classnames'
  2. import { DefaultLayout } from 'components/DefaultLayout'
  3. import { ArticleVersionPicker } from 'components/article/ArticleVersionPicker'
  4. import { Breadcrumbs } from 'components/Breadcrumbs'
  5. import { ArticleTitle } from 'components/article/ArticleTitle'
  6. import { useArticleContext } from 'components/context/ArticleContext'
  7. import { InfoIcon } from '@primer/octicons-react'
  8. import { useTranslation } from 'components/hooks/useTranslation'
  9. import { LearningTrackNav } from './LearningTrackNav'
  10. export const ArticlePage = () => {
  11. const {
  12. title,
  13. intro,
  14. renderedPage,
  15. contributor,
  16. permissions,
  17. includesPlatformSpecificContent,
  18. defaultPlatform,
  19. product,
  20. miniTocItems,
  21. currentLearningTrack,
  22. } = useArticleContext()
  23. const { t } = useTranslation('pages')
  24. return (
  25. <DefaultLayout>
  26. <div className="container-xl px-3 px-md-6 my-4 my-lg-4">
  27. <article className="markdown-body">
  28. <div className="d-lg-flex flex-justify-between">
  29. <div className="d-block d-lg-none">
  30. <ArticleVersionPicker />
  31. </div>
  32. <div className="d-flex flex-items-center">
  33. <Breadcrumbs />
  34. </div>
  35. <div className="d-none d-lg-block">
  36. <ArticleVersionPicker />
  37. </div>
  38. </div>
  39. <div className="article-grid-container mt-2">
  40. <div className="article-grid-head">
  41. <ArticleTitle>{title}</ArticleTitle>
  42. {contributor && (
  43. <div className="contributor-callout border rounded-1 mb-4 p-3 color-border-info color-bg-info f5">
  44. <p>
  45. <span className="mr-2">
  46. <InfoIcon />
  47. </span>
  48. {t('contributor_callout')} <a href={contributor.URL}>{contributor.name}</a>.
  49. </p>
  50. </div>
  51. )}
  52. {intro && (
  53. <div className="lead-mktg">
  54. <p>{intro}</p>
  55. </div>
  56. )}
  57. {permissions && (
  58. <div
  59. className="permissions-statement"
  60. dangerouslySetInnerHTML={{ __html: permissions }}
  61. />
  62. )}
  63. {includesPlatformSpecificContent && (
  64. <nav
  65. className="UnderlineNav my-3"
  66. data-default-platform={defaultPlatform || undefined}
  67. >
  68. <div className="UnderlineNav-body">
  69. <a href="#" className="UnderlineNav-item platform-switcher" data-platform="mac">
  70. Mac
  71. </a>
  72. <a
  73. href="#"
  74. className="UnderlineNav-item platform-switcher"
  75. data-platform="windows"
  76. >
  77. Windows
  78. </a>
  79. <a
  80. href="#"
  81. className="UnderlineNav-item platform-switcher"
  82. data-platform="linux"
  83. >
  84. Linux
  85. </a>
  86. </div>
  87. </nav>
  88. )}
  89. {product && (
  90. <div
  91. className="product-callout border rounded-1 mb-4 p-3 color-border-success color-bg-success"
  92. dangerouslySetInnerHTML={{ __html: product }}
  93. />
  94. )}
  95. </div>
  96. <div className="article-grid-toc border-bottom border-xl-0 pb-4 mb-5 pb-xl-0 mb-xl-0">
  97. <div className="article-grid-toc-content">
  98. {miniTocItems.length > 1 && (
  99. <>
  100. <h2 id="in-this-article" className="f5 mb-2">
  101. <a className="Link--primary" href="#in-this-article">
  102. {t('miniToc')}
  103. </a>
  104. </h2>
  105. <ul className="list-style-none pl-0 f5 mb-0">
  106. {miniTocItems.map((item) => {
  107. return (
  108. <li
  109. key={item.contents}
  110. className={cx(
  111. `ml-${item.indentationLevel * 3}`,
  112. item.platform,
  113. 'mb-2 lh-condensed'
  114. )}
  115. dangerouslySetInnerHTML={{ __html: item.contents }}
  116. />
  117. )
  118. })}
  119. </ul>
  120. </>
  121. )}
  122. </div>
  123. </div>
  124. <div className="markdown-body">
  125. <div
  126. id="article-contents"
  127. className="article-grid-body"
  128. dangerouslySetInnerHTML={{ __html: renderedPage }}
  129. />
  130. </div>
  131. </div>
  132. {currentLearningTrack?.trackName ? (
  133. <div className="d-block mt-4 markdown-body">
  134. <LearningTrackNav track={currentLearningTrack} />
  135. </div>
  136. ) : null}
  137. </article>
  138. </div>
  139. </DefaultLayout>
  140. )
  141. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...