First thing we should do for our App is to create index.html
file with app's skeleton.
First of all, let's look on the most basic layout for iOS theme
//App.jsx
const App = () => (
{/* Views */}
{/* Your main view, should have "main" prop */}
{/* Pages container, because we use fixed navbar and toolbar, it has additional appropriate props */}
{/* Initial Page /*}
{/* Top Navbar /*}
{/* Toolbar */}
Link 1
Link 2
{/* Page Content */}
Page content goes here
About App
);
As you may see the layout is pretty simple. The main point is that you should link Framework7's CSS in the <head>
and JS files in the end of <body>
.
You can read more about statusbar overlay, views, navbar, toolbar, pages, panels and other components in appropriate sections.
<!DOCTYPE html>
<html>
<head>
<!-- Required meta tags-->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Color theme for statusbar -->
<meta name="theme-color" content="#2196f3">
<!-- Your app title -->
<title>My App</title>
<!-- Path to Framework7 Library CSS, Material Theme -->
<link rel="stylesheet" href="path/to/framework7.material.min.css">
<!-- Path to Framework7 color related styles, Material Theme -->
<link rel="stylesheet" href="path/to/framework7.material.colors.min.css">
<!-- Path to your custom app styles-->
<link rel="stylesheet" href="path/to/my-app.css">
</head>
<body>
<!-- Views -->
<div class="views">
<!-- Your main view, should have "view-main" class -->
<div class="view view-main">
<!-- Pages container, because we use fixed navbar and toolbar, it has additional appropriate classes-->
<div class="pages navbar-fixed toolbar-fixed">
<!-- Page, "data-page" contains page name -->
<div data-page="index" class="page">
<!-- Top Navbar. In Material theme it should be inside of the page-->
<div class="navbar">
<div class="navbar-inner">
<div class="center">Awesome App</div>
</div>
</div>
<!-- Toolbar. In Material theme it should be inside of the page-->
<div class="toolbar">
<div class="toolbar-inner">
<!-- Toolbar links -->
<a href="#" class="link">Link 1</a>
<a href="#" class="link">Link 2</a>
</div>
</div>
<!-- Scrollable page content -->
<div class="page-content">
<p>Page content goes here</p>
<!-- Link to another page -->
<a href="about.html">About app</a>
</div>
</div>
</div>
</div>
</div>
<!-- Path to Framework7 Library JS-->
<script type="text/javascript" src="path/to/framework7.min.js"></script>
<!-- Path to your app js-->
<script type="text/javascript" src="path/to/my-app.js"></script>
</body>
</html>
As you may see the Material layout is almost the same. It just has different CSS files related to Material theme, and a bit different page structure where Navbar and Toolbar are inside of the page
Now when we have basic template, we need to initialize our app in my-app.js
.