Skip to content

Instantly share code, notes, and snippets.

@kashishgrover
Last active November 30, 2018 19:55
Show Gist options
  • Save kashishgrover/bcefee1bdefb8e08a09fdd6046afdf77 to your computer and use it in GitHub Desktop.
Save kashishgrover/bcefee1bdefb8e08a09fdd6046afdf77 to your computer and use it in GitHub Desktop.
Example of a banner using LeafUI
import React from 'react';
import theme from 'leaf-ui/theme/native';
import Text from 'leaf-ui/Text/native';
import Card from 'leaf-ui/Card/native';
import Space from 'leaf-ui/Space/native';
import Flex from 'leaf-ui/Flex/native';
import { getIcon } from '../../utils/Icon';
class ExampleBanner extends React.Component {
state = {};
render() {
const bannerText = "This is a testy test";
return (
<Space padding={[2]} margin={[1, 1, 0, 1]}>
{/* Paddings and Margins are all multiples of 8. With scaling, a little more than depending on the device. :)*/}
<Flex flexDirection="row" alignItems="center">
<Card backgroundColor="yellowLighter" borderColor="yellow">
{getIcon('special_icon', theme.color.greyDark)}
<Space margin={[0, 1]}>
<Text>{bannerText}</Text>
{/* Font size is also scaled! */}
</Space>
</Card>
</Flex>
</Space>
);
}
}
export default ExampleBanner;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment