Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | 1x 1x 1x 1x 1x 1x 1x 2x | // @flow strict
import React, { useEffect } from 'react';
import LayoutCell from './material-toolbox/layout-grid/Cell';
import Text from './material-toolbox/typography/Text';
import List from './material-toolbox/list';
import ListItem from './material-toolbox/list/Item';
import Example from './Example';
import ThemedLink from './ThemedLink';
import ComponentTitle from './ComponentTitle';
import SectionTitle from './SectionTitle';
import Highlighter from './Highlighter';
const source = `import React from 'react';
import TopAppBar from 'material-toolbox/top-app-bar';
import TopAppBarRow from 'material-toolbox/top-app-bar/Row';
import TopAppBarSection from 'material-toolbox/top-app-bar/Section';
import TopAppBarTitle from 'material-toolbox/top-app-bar/Title';
import TopAppBarIcon from 'material-toolbox/top-app-bar/Icon';
import TopAppBarAction from 'material-toolbox/top-app-bar/Action';
import TopAppBarAdjuster from 'material-toolbox/top-app-bar/Adjuster';
const TopAppBarExample = ({ type }) => {
let titleApp;
const props = {
short: false,
fixed: false,
dense: false,
prominent: false,
collapsed: false,
};
switch (type) {
case 'standard':
titleApp = 'Standard';
break;
case 'fixed':
titleApp = 'Fixed';
props.fixed = true;
break;
case 'dense':
titleApp = 'Dense';
props.dense = true;
break;
case 'prominent':
titleApp = 'Prominent';
props.prominent = true;
break;
case 'short':
titleApp = 'Short';
props.short = true;
break;
case 'alwaysShort':
props.short = true;
props.collapsed = true;
break;
default:
break;
}
return (
<React.Fragment>
<TopAppBar {...props}>
<TopAppBarRow>
<TopAppBarSection>
<TopAppBarIcon href="#" className="material-icons">
menu
</TopAppBarIcon>
<TopAppBarTitle>{titleApp}</TopAppBarTitle>
</TopAppBarSection>
<TopAppBarSection end>
<TopAppBarAction
label="Download"
href="#"
className="material-icons">
file_download
</TopAppBarAction>
{!props.short && (
<React.Fragment>
<TopAppBarAction
label="Print"
href="#"
className="material-icons">
print
</TopAppBarAction>
<TopAppBarAction
label="Bookmark this page"
href="#"
className="material-icons">
bookmark
</TopAppBarAction>
</React.Fragment>
)}
</TopAppBarSection>
</TopAppBarRow>
</TopAppBar>
<TopAppBarAdjuster {...props}>
<main className="demo-main">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec odio
lorem, efficitur ac faucibus eget, tempor ac tellus. Sed a neque
leo. Donec hendrerit ac purus in rutrum. Aliquam in velit eu massa
porttitor dapibus. Sed posuere volutpat orci, non egestas lectus
rhoncus id. Cras a odio molestie, semper nibh id, pellentesque
neque. Aliquam imperdiet risus non nisl ultricies, sit amet rhoncus
purus congue. Donec consectetur leo quis leo dapibus consequat.
Aliquam pretium nulla posuere tortor aliquam suscipit. Duis ornare
orci vel nisl lobortis lacinia.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec odio
lorem, efficitur ac faucibus eget, tempor ac tellus. Sed a neque
leo. Donec hendrerit ac purus in rutrum. Aliquam in velit eu massa
porttitor dapibus. Sed posuere volutpat orci, non egestas lectus
rhoncus id. Cras a odio molestie, semper nibh id, pellentesque
neque. Aliquam imperdiet risus non nisl ultricies, sit amet rhoncus
purus congue. Donec consectetur leo quis leo dapibus consequat.
Aliquam pretium nulla posuere tortor aliquam suscipit. Duis ornare
orci vel nisl lobortis lacinia.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec odio
lorem, efficitur ac faucibus eget, tempor ac tellus. Sed a neque
leo. Donec hendrerit ac purus in rutrum. Aliquam in velit eu massa
porttitor dapibus. Sed posuere volutpat orci, non egestas lectus
rhoncus id. Cras a odio molestie, semper nibh id, pellentesque
neque. Aliquam imperdiet risus non nisl ultricies, sit amet rhoncus
purus congue. Donec consectetur leo quis leo dapibus consequat.
Aliquam pretium nulla posuere tortor aliquam suscipit. Duis ornare
orci vel nisl lobortis lacinia.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec odio
lorem, efficitur ac faucibus eget, tempor ac tellus. Sed a neque
leo. Donec hendrerit ac purus in rutrum. Aliquam in velit eu massa
porttitor dapibus. Sed posuere volutpat orci, non egestas lectus
rhoncus id. Cras a odio molestie, semper nibh id, pellentesque
neque. Aliquam imperdiet risus non nisl ultricies, sit amet rhoncus
purus congue. Donec consectetur leo quis leo dapibus consequat.
Aliquam pretium nulla posuere tortor aliquam suscipit. Duis ornare
orci vel nisl lobortis lacinia.
</p>
</main>
</TopAppBarAdjuster>
</React.Fragment>
);
};
export default TopAppBarExample;`;
const scssSource = `@import url("https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css");
$mdc-theme-primary: #00838f;
$mdc-theme-secondary: #80cbc4;
@import "@material/theme/mdc-theme";
@import "@material/ripple/mdc-ripple";
@import "@material/top-app-bar/mdc-top-app-bar";
@import "@material/icon-button/mdc-icon-button";
@import "@material/form-field/mdc-form-field";`;
const resources = [
{
href: 'https://material.io/go/design-app-bar-top',
target: '_blank',
children: 'Material Design Guidelines',
},
{
href: 'https://material.io/components/web/catalog/top-app-bar/',
target: '_blank',
children: 'Material Components Web Documentation',
},
];
const TopAppBarPage = () => {
useEffect(() => {
window.scrollTo(0, 0);
}, []);
return (
<LayoutCell align="bottom" span={12}>
<h1>Top App Bar</h1>
<Text as="p" text="overline">
Top App Bar components are a React wrappers of mdc-top-app-bar
component.
</Text>
<SectionTitle>Resources</SectionTitle>
<List>
{resources.map(item => (
<ListItem key={item.href} as={ThemedLink} {...item} />
))}
</List>
<SectionTitle>Components</SectionTitle>
<ComponentTitle>TopAppBar</ComponentTitle>
<table className="table-props">
<thead>
<tr>
<th>Property</th>
<th>Type</th>
<th>Default</th>
<th>Required</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>fixed</td>
<td>boolean</td>
<td>false</td>
<td />
<td>Set a fixed TopAppBar</td>
</tr>
<tr>
<td>short</td>
<td>boolean</td>
<td>false</td>
<td />
<td>Set a short style TopAppBar</td>
</tr>
<tr>
<td>collapsed</td>
<td>boolean</td>
<td>false</td>
<td />
<td>Sets collapsed version of short style TopAppBar</td>
</tr>
<tr>
<td>prominent</td>
<td>boolean</td>
<td>false</td>
<td />
<td>Set prominent style TopAppBar</td>
</tr>
<tr>
<td>scrollTarget</td>
<td>HTMLElement</td>
<td />
<td />
<td>Used to control scroll, if not set use window object</td>
</tr>
<tr>
<td>dense</td>
<td>boolean</td>
<td>false</td>
<td />
<td>
Set dense version on standard, fixed, prominent syle TopAppBar
</td>
</tr>
</tbody>
</table>
<ComponentTitle>TopAppBarRow</ComponentTitle>
<ComponentTitle>TopAppBarSection</ComponentTitle>
<table className="table-props">
<thead>
<tr>
<th>Property</th>
<th>Type</th>
<th>Default</th>
<th>Required</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>end</td>
<td>boolean</td>
<td>false</td>
<td />
<td>The second section into the row</td>
</tr>
</tbody>
</table>
<ComponentTitle>TopAppBarTitle</ComponentTitle>
<ComponentTitle>TopAppBarAdjuster</ComponentTitle>
<table className="table-props">
<thead>
<tr>
<th>Property</th>
<th>Type</th>
<th>Default</th>
<th>Required</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>short</td>
<td>boolean</td>
<td>false</td>
<td />
<td>Set a short style TopAppBarAdjuster</td>
</tr>
<tr>
<td>prominent</td>
<td>boolean</td>
<td>false</td>
<td />
<td>Set prominent style TopAppBarAdjuster</td>
</tr>
<tr>
<td>dense</td>
<td>boolean</td>
<td>false</td>
<td />
<td>
Set dense version on standard, fixed, prominent syle
TopAppBarAdjuster
</td>
</tr>
</tbody>
</table>
<ComponentTitle>useTopAppBarAdjuster</ComponentTitle>
<Highlighter language="jsx">{`const useTopAppBarAdjuster = ({
short = false,
dense = false,
prominent = false,
}: {
short: boolean,
dense: boolean,
prominent: boolean,
}) => string`}</Highlighter>
<ComponentTitle>TopAppBarAction</ComponentTitle>
<ComponentTitle>TopAppBarIcon</ComponentTitle>
<SectionTitle>Demos</SectionTitle>
<Example title="" source={source} scss={scssSource}>
<div className="top-app-bar-demo-grid">
<div className="top-app-bar-demo">
<div>
<a href="./top-app-bar/standard.html">Standard</a>
</div>
<div>
<iframe
className="top-app-bar-frame"
title="Standard"
src="./top-app-bar/standard.html"
frameBorder="0"
/>
</div>
</div>
<div className="top-app-bar-demo">
<div>
<a href="./top-app-bar/fixed.html">Fixed</a>
</div>
<div>
<iframe
className="top-app-bar-frame"
title="Dense"
src="./top-app-bar/fixed.html"
frameBorder="0"
/>
</div>
</div>
<div className="top-app-bar-demo">
<div>
<a href="./top-app-bar/dense.html">Dense</a>
</div>
<div>
<iframe
className="top-app-bar-frame"
title="Dense"
src="./top-app-bar/dense.html"
frameBorder="0"
/>
</div>
</div>
<div className="top-app-bar-demo">
<div>
<a href="./top-app-bar/prominent.html">Prominent</a>
</div>
<div>
<iframe
className="top-app-bar-frame"
title="Prominent"
src="./top-app-bar/prominent.html"
frameBorder="0"
/>
</div>
</div>
<div className="top-app-bar-demo">
<div>
<a href="./top-app-bar/short.html">Short</a>
</div>
<div>
<iframe
className="top-app-bar-frame"
title="Short"
src="./top-app-bar/short.html"
frameBorder="0"
/>
</div>
</div>
<div className="top-app-bar-demo">
<div>
<a href="./top-app-bar/always-short.html">
Short - Always Collapsed
</a>
</div>
<div>
<iframe
className="top-app-bar-frame"
title="Always Short"
src="./top-app-bar/always-short.html"
frameBorder="0"
/>
</div>
</div>
</div>
</Example>
</LayoutCell>
);
};
export default TopAppBarPage;
|