// Test file for react-mdl Definition file
///
import * as React from 'react';
import {Badge,
FABButton, Button, IconButton,
Card, CardActions, CardTitle, CardText, CardMenu, CardMedia,
Checkbox,
DataTable, TableHeader, Table,
Dialog, DialogTitle, DialogContent, DialogActions,
Grid, Cell,
Icon, IconToggle,
Layout, Header, Navigation, Drawer, Content, HeaderRow, HeaderTabs, Footer, FooterDropDownSection, FooterLinkList, FooterSection,
List, ListItem, ListItemContent, ListItemAction,
Menu, MenuItem,
ProgressBar,
RadioGroup, Radio,
Slider,
Snackbar,
Spinner,
Switch,
Tabs, Tab,
Textfield,
Tooltip} from 'react-mdl';
// all tests are from the examples provided here: https://tleunen.github.io/react-mdl/
// Badge tests
React.createClass({
render: function() {
return (
{/* Number badge on icon */}
{/* Icon badge on icon */}
{/* Number badge on text */}
Inbox
{/* Icon badge without background on text */}
Mood
);
}
});
// Button tests
React.createClass({
render: function() {
return (
{/* Colored FAB button */}
{/* Colored FAB button with ripple */}
{/* FAB button */}
{/* FAB button with ripple */}
{/* Disabled FAB button */}
{/* Mini FAB button */}
{/* Colored Mini FAB button */}
{/* Raised button */}
Button
{/* Raised button with ripple */}
Button
{/* Disabled Raised button */}
Button
{/* Colored Raised button */}
Button
{/* Accent-colored button without ripple */}
Button
{/* Accent-colored button with ripple */}
Button
{/* Flat button */}
Button
{/* Flat button with ripple */}
Button
{/* Disabled flat button */}
Button
{/* Primary colored flat button */}
Button
{/* Accent-colored flat button */}
Button
{/* Icon button */}
{/* Colored Icon button */}
);
}
})
// Card tests
React.createClass({
render: function() {
return (
Welcome
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Mauris sagittis pellentesque lacus eleifend lacinia...
Get Started
Update
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Aenan convallis.
View Updates
Image.jpg
Featured event:
May 24, 2016
7-11pm
Add to Calendar
);
}
});
// Checkbox tests
React.createClass({
render: function() {
return (
);
}
});
// DataTable tests
React.createClass({
render: function() {
return (
Material
Quantity
`\$${price.toFixed(2)}`} tooltip="Price pet unit">Price
Material
Quantity
`\$${price.toFixed(2)}`} tooltip="Price pet unit">Price
(isAsc ? a : b).match(/\((.*)\)/)[1].localeCompare((isAsc ? b : a).match(/\((.*)\)/)[1])}
tooltip="The amazing material name"
>
Material
Quantity
`\$${price.toFixed(2)}`}
tooltip="Price pet unit"
>
Price
);
}
});
// Dialog tests
React.createClass({
render: function() {
return (
Show Dialog
Allow data collection?
Allowing us to collect data will let us get you the information you want faster.
Agree
Disagree
Show Modal
Allow this site to collect usage data to improve your experience?
Allowing us to collect data will let us get you the information you want faster.
Agree
Disagree
Show Dialog
Allow data collection?
Allowing us to collect data will let us get you the information you want faster.
Agree
Disagree
);
}
});
// Grid tests
React.createClass({
render: function() {
return (
| 1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
| 4 |
4 |
4 |
| 6 |
4 |
2 |
| 6 (8 tablet) |
4 (6 tablet) |
2 (4 phone) |
);
}
});
// IconToggle tests
React.createClass({
render: function() {
return (
);
}
});
// Layout tests
React.createClass({
render: function() {
return (
{/* Uses a transparent header that draws on top of the layout's background */}
{/* No header, and the drawer stays open on larger screens (fixed drawer). */}
{/* Always shows a header, even in smaller screens. */}
{/* The drawer is always open in large screens. The header is always shown, even in small screens. */}
{/* Uses a header that scrolls with the text, rather than staying locked at the top */}
{/* Uses a header that contracts as the page scrolls down. */}
{/* Hide the top part of the header when scrolling down */}
this.setState({ activeTab: tabId })}>
Tab1
Tab2
Tab3
Tab4
Tab5
Tab6
Content for the tab: {this.state.activeTab}
{/* Simple header with fixed tabs. */}
You can add logic to update the content of this container based on the "activeTab" receive in the `onChange` callback.
);
}
});
// List tests
React.createClass({
render: function() {
return (
Bryan Cranston
Aaron Paul
Bob Odenkirk
Bryan Cranston
Aaron Paul
Bob Odenkirk
Bryan Cranston
Aaron Paul
Bob Odenkirk
Bryan Cranston
Aaron Paul
Bob Odenkirk
Bryan Cranston
Aaron Paul
Bob Odenkirk
Bryan Cranston
Aaron Paul
Bob Odenkirk
);
}
});
// Menu tests
React.createClass({
render: function() {
return (
{/* Lower left */}
Some Action
Another Action
Disabled Action
Yet Another Action
{/* Lower right */}
Some Action
Another Action
Disabled Action
Yet Another Action
{/* Top left */}
Some Action
Another Action
Disabled Action
Yet Another Action
{/* Top right */}
Some Action
Another Action
Disabled Action
Yet Another Action
);
}
});
// ProgressBar tests
React.createClass({
render: function() {
return (
{/* Simple Progress Bar */}
{/* Progress Bar with Indeterminate Progress */}
{/* Progress Bar with Buffering */}
);
}
});
// Radio tests
React.createClass({
render: function() {
return (
Ripple option
Other option
Ripple option
Other option
);
}
});
// Slider tests
React.createClass({
render: function() {
return (
{/* Default slider */}
{/* Slider with initial value */}
);
}
});
// Snackbar tests
React.createClass({
render: function() {
return (
Show a Snackbar
Button color changed.
Show a Toast
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius luctus quam. Fusce quis blandit libero. Donec accumsan nunc lectus, vel blandit diam bibendum ac. Integer faucibus, lorem et convallis fermentum, diam dolor imperdiet mi, nec iaculis risus mauris id elit. Vivamus vel eros dapibus, molestie ante ut, vestibulum sem.
);
}
});
// Spinner tests
React.createClass({
render: function() {
return (
{/* Simple spinner */}
{/* Single color spinner */}
);
}
});
// Switch tests
React.createClass({
render: function() {
return (
Ripple switch
Switch
);
}
});
// Tab tests
React.createClass({
render: function() {
return (
this.setState({ activeTab: tabId })} ripple>
Starks
Lannisters
Targaryens
Content for the tab: {this.state.activeTab}
);
}
});
// Textfield tests
React.createClass({
render: function() {
return (
{/* Simple textfield */}
{}}
label="Text..."
style={{width: '200px'}}
/>
{/* Numeric textfield */}
{}}
pattern="-?[0-9]*(\.[0-9]+)?"
error="Input is not a number!"
label="Number..."
style={{width: '200px'}}
/>
{/* Textfield with floating label */}
{}}
label="Text..."
floatingLabel
style={{width: '200px'}}
/>
{/* Numeric Textfield with floating label */}
{}}
pattern="-?[0-9]*(\.[0-9]+)?"
error="Input is not a number!"
label="Number..."
floatingLabel
/>
);
}
});
// Tooltip tests
React.createClass({
render: function() {
return (
{/* Simple tooltip */}
{/* Large Tooltip */}
{/* Rich Tooltip */}
Upload file.zip }>
{/* Multiline Tooltip */}
Share your content via social media}>
{/* Right Tooltip */}
{/* Left Tooltip */}
{/* Top Tooltip */}
{/* Bottom Tooltip */}
);
}
});