Layout scaffolding for Web apps.
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. import * as React from 'react'
  2. import * as ReactDOM from 'react-dom';
  3. import ReactMarkdown from 'react-markdown';
  4. import Brand from '../../components/Brand';
  5. import { LeftSidebarWithMenu } from '../../..';
  6. const Page = () => {
  7. const [sidebarMainOpen, setSidebarMainOpen] = React.useState(location.hash === '#sidebar')
  8. const [moreItemsOpen, setMoreItemsOpen] = React.useState(location.hash === '#more')
  9. React.useEffect(() => {
  10. const handleHashChange = () => {
  11. setSidebarMainOpen(location.hash === '#sidebar')
  12. setMoreItemsOpen(location.hash === '#more')
  13. }
  14. window.addEventListener('hashchange', handleHashChange)
  15. return () => {
  16. window.removeEventListener('hashchange', handleHashChange)
  17. }
  18. }, [])
  19. return (
  20. <LeftSidebarWithMenu.Layout
  21. moreItemsOpen={moreItemsOpen}
  22. sidebarMenuItems={[
  23. {
  24. id: 'foo',
  25. icon: 'F',
  26. label: 'Foo',
  27. url: '#foo',
  28. },
  29. {
  30. id: 'bar',
  31. icon: 'B',
  32. label: 'Bar',
  33. url: '#bar',
  34. },
  35. {
  36. id: 'baz',
  37. icon: 'Z',
  38. label: 'Baz',
  39. url: '#baz',
  40. },
  41. {
  42. id: 'quux',
  43. icon: 'Q',
  44. label: 'Quux',
  45. url: '#quux',
  46. },
  47. {
  48. id: 'quuux',
  49. icon: 'U',
  50. label: 'Quuux',
  51. url: '#quuux',
  52. secondary: true,
  53. },
  54. {
  55. id: 'quuuux',
  56. icon: 'X',
  57. label: 'Quuuux',
  58. url: '#quuuux',
  59. secondary: true,
  60. },
  61. ]}
  62. moreLinkMenuItem={{
  63. url: '#more',
  64. icon: 'M',
  65. label: 'More',
  66. }}
  67. linkComponent={({
  68. url,
  69. icon,
  70. label,
  71. }) => (
  72. <a
  73. href={url}
  74. >
  75. <LeftSidebarWithMenu.SidebarMenuContainer>
  76. <LeftSidebarWithMenu.SidebarMenuItemIcon>
  77. {icon}
  78. </LeftSidebarWithMenu.SidebarMenuItemIcon>
  79. {label}
  80. </LeftSidebarWithMenu.SidebarMenuContainer>
  81. </a>
  82. )}
  83. moreLinkComponent={({
  84. url,
  85. icon,
  86. label,
  87. }) => (
  88. <a
  89. href={url}
  90. >
  91. <LeftSidebarWithMenu.MoreSidebarMenuContainer>
  92. <LeftSidebarWithMenu.MoreSidebarMenuItemIcon>
  93. {icon}
  94. </LeftSidebarWithMenu.MoreSidebarMenuItemIcon>
  95. {label}
  96. </LeftSidebarWithMenu.MoreSidebarMenuContainer>
  97. </a>
  98. )}
  99. brand={
  100. <Brand />
  101. }
  102. sidebarMainOpen={sidebarMainOpen}
  103. menuLink={
  104. <a
  105. href="#sidebar"
  106. >
  107. Menu
  108. </a>
  109. }
  110. userLink={
  111. <a
  112. href="#user"
  113. >
  114. User
  115. </a>
  116. }
  117. sidebarMain={
  118. <>
  119. <a
  120. href="#foo"
  121. style={{
  122. display: 'flex',
  123. alignItems: 'center',
  124. height: '3rem',
  125. }}
  126. >
  127. <LeftSidebarWithMenu.SidebarMainContainer>
  128. Foo
  129. </LeftSidebarWithMenu.SidebarMainContainer>
  130. </a>
  131. <a
  132. href="#bar"
  133. style={{
  134. display: 'flex',
  135. alignItems: 'center',
  136. height: '3rem',
  137. }}
  138. >
  139. <LeftSidebarWithMenu.SidebarMainContainer>
  140. Bar
  141. </LeftSidebarWithMenu.SidebarMainContainer>
  142. </a>
  143. <a
  144. href="#baz"
  145. style={{
  146. display: 'flex',
  147. alignItems: 'center',
  148. height: '3rem',
  149. }}
  150. >
  151. <LeftSidebarWithMenu.SidebarMainContainer>
  152. Baz
  153. </LeftSidebarWithMenu.SidebarMainContainer>
  154. </a>
  155. </>
  156. }
  157. >
  158. <LeftSidebarWithMenu.ContentContainer>
  159. <ReactMarkdown
  160. components={{
  161. img: ({ src, alt, style, }) => (
  162. <img
  163. src={src}
  164. alt={alt}
  165. style={{
  166. ...style,
  167. width: '100%',
  168. }}
  169. />
  170. )
  171. }}
  172. >
  173. {`# Piano
  174. ![Bechstein Moor](/static/piano/chris-maene-cm228-parlor-grand-00.jpg)
  175. The piano is an acoustic, stringed musical instrument invented in Italy by Bartolomeo Cristofori around the year 1700 (the exact year is uncertain), in which the strings are struck by wooden hammers that are coated with a softer material (modern hammers are covered with dense wool felt; some early pianos used leather). It is played using a keyboard, which is a row of keys (small levers) that the performer presses down or strikes with the fingers and thumbs of both hands to cause the hammers to strike the strings.
  176. ![Bechstein Moor](/static/piano/chris-maene-cm250-chamber-concert-grand-00.jpg)
  177. The word piano is a shortened form of pianoforte, the Italian term for the early 1700s versions of the instrument, which in turn derives from gravicembalo col piano e forte (key cymbal with quieter and louder) and fortepiano. The Italian musical terms piano and forte indicate "soft" and "loud" respectively, in this context referring to the variations in volume (i.e., loudness) produced in response to a pianist's touch or pressure on the keys: the greater the velocity of a key press, the greater the force of the hammer hitting the strings, and the louder the sound of the note produced and the stronger the attack. The name was created as a contrast to harpsichord, a musical instrument that does not allow variation in volume; compared to the harpsichord, the first fortepianos in the 1700s had a quieter sound and smaller dynamic range.
  178. ![Bösendorfer Moor](/static/piano/chris-maene-cm284-concert-grand-00.jpg)
  179. A piano usually has a protective wooden case surrounding the soundboard and metal strings, which are strung under great tension on a heavy metal frame. Pressing one or more keys on the piano's keyboard causes a wooden or plastic hammer (typically padded with firm felt) to strike the strings. The hammer rebounds from the strings, and the strings continue to vibrate at their resonant frequency. These vibrations are transmitted through a bridge to a soundboard that amplifies by more efficiently coupling the acoustic energy to the air. When the key is released, a damper stops the strings' vibration, ending the sound. Notes can be sustained, even when the keys are released by the fingers and thumbs, by the use of pedals at the base of the instrument. The sustain pedal enables pianists to play musical passages that would otherwise be impossible, such as sounding a 10-note chord in the lower register and then, while this chord is being continued with the sustain pedal, shifting both hands to the treble range to play a melody and arpeggios over the top of this sustained chord. Unlike the pipe organ and harpsichord, two major keyboard instruments widely used before the piano, the piano allows gradations of volume and tone according to how forcefully or softly a performer presses or strikes the keys.
  180. ![Bösendorfer Moor](/static/piano/grotrian-duo-double-grand.jpg)
  181. Most modern pianos have a row of 88 black and white keys, 52 white keys for the notes of the C major scale (C, D, E, F, G, A and B) and 36 shorter black keys, which are raised above the white keys, and set further back on the keyboard. This means that the piano can play 88 different pitches (or "notes"), going from the deepest bass range to the highest treble. The black keys are for the "accidentals" (F♯/G♭, G♯/A♭, A♯/B♭, C♯/D♭, and D♯/E♭), which are needed to play in all twelve keys. More rarely, some pianos have additional keys (which require additional strings), an example of which is the Bösendorfer Concert Grand 290 Imperial, which has 97 keys. Most notes have three strings, except for the bass, which graduates from one to two. The strings are sounded when keys are pressed or struck, and silenced by dampers when the hands are lifted from the keyboard. Although an acoustic piano has strings, it is usually classified as a percussion instrument rather than as a stringed instrument, because the strings are struck rather than plucked (as with a harpsichord or spinet); in the Hornbostel–Sachs system of instrument classification, pianos are considered chordophones. There are two main types of piano: the grand piano and the upright piano. The grand piano has a better sound and gives the player a more precise control of the keys, and is therefore the preferred choice for every situation in which the available floor-space and the budget will allow, as well as often being considered a requirement in venues where skilled pianists will frequently give public performances. The upright piano, which necessarily involves some compromise in both tone and key action compared to a grand piano of equivalent quality, is nevertheless much more widely used, because it occupies less space (allowing it to fit comfortably in a room where a grand piano would be too large) and is significantly less expensive.
  182. ![Bösendorfer Moor](/static/piano/grotrian-steinweg-double-grand-00.jpg)
  183. During the 1800s, influenced by the musical trends of the Romantic music era, innovations such as the cast iron frame (which allowed much greater string tensions) and aliquot stringing gave grand pianos a more powerful sound, with a longer sustain and richer tone. In the nineteenth century, a family's piano played the same role that a radio or phonograph played in the twentieth century; when a nineteenth-century family wanted to hear a newly published musical piece or symphony, they could hear it by having a family member play a simplified version on the piano. During the nineteenth century, music publishers produced many types of musical works (symphonies, opera overtures, waltzes, etc.) in arrangements for piano, so that music lovers could play and hear the popular pieces of the day in their home. The piano is widely employed in classical, jazz, traditional and popular music for solo and ensemble performances, accompaniment, and for composing, songwriting and rehearsals. Although the piano is very heavy and thus not portable and is expensive (in comparison with other widely used accompaniment instruments, such as the acoustic guitar), its musical versatility (i.e., its wide pitch range, ability to play chords, louder or softer notes and two or more independent musical lines at the same time), the large number of musicians - both amateurs and professionals - trained in playing it, and its wide availability in performance venues, schools and rehearsal spaces have made it one of the Western world's most familiar musical instruments.`}
  184. </ReactMarkdown>
  185. </LeftSidebarWithMenu.ContentContainer>
  186. </LeftSidebarWithMenu.Layout>
  187. )
  188. }
  189. const root = document.createElement('div')
  190. ReactDOM.render(<Page />, root);
  191. document.body.appendChild(root);