This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //ProtectedRoute.js | |
| import React from 'react'; | |
| import { Route, Redirect } from 'react-router-dom'; | |
| import { AuthConsumer } from '../auth/AuthContext'; | |
| export const ProtectedRoute = ({ | |
| component: Component, | |
| ...rest | |
| }) => ( | |
| <Route |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //AuthContext.js | |
| import React, { useState, createContext } from 'react'; | |
| const AuthContext = createContext(false); | |
| function AuthProvider(props) { | |
| const isCredentialsExist = JSON.parse(localStorage.getItem('credentials')) !== null ? true : false; | |
| const [isAuth, setIsAuth] = useState(isCredentialsExist); | |
| return ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="colors"> | |
| <?php | |
| foreach ($product['colors'] as $key=>$item) { | |
| ?> | |
| <button | |
| on="tap:<?php echo $product['id'] ?>.goToSlide(index=<?php echo $key ?>)" | |
| [class]="selected.<?php echo $product['id'] ?>.tab == <?php echo $key ?> ? 'active-product' : '' " | |
| > | |
| </button> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <amp-carousel | |
| class="amp-carousel-slide" | |
| controls="false" | |
| on="slideChange:AMP.setState({ | |
| selected: { | |
| <?php echo $product['id'] ?>:{ | |
| tab: event.index | |
| } | |
| } | |
| })" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <amp-state id="selected"> | |
| <script type="application/json"> | |
| { | |
| <?php | |
| for($i=0; $i<count($products); $i++) { | |
| if ($i < ( count( $products ) - 1 ) ) { | |
| $delimeter = ','; | |
| } else { | |
| $delimeter = ''; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function tabs_amp_module() | |
| { | |
| $cssPath = 'Your css path'; | |
| if (file_exists($cssPath)) { | |
| echo file_get_contents($cssPath); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <head> | |
| <style amp-custom> | |
| <?php | |
| do_action("AMP_MODULE_CSS"); | |
| ?> | |
| </style> | |
| </head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta | |
| name="viewport" | |
| content="width=device-width, initial-scale=1, shrink-to-fit=no" | |
| /> | |
| <meta name="theme-color" content="#000000" /> | |
| <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "manifest_version": 2, | |
| "name": "Endoplazmik Retikulum", | |
| "author": "Ebru Gulec", | |
| "version": "1.0.2", | |
| "description": "Replace new tab screen with amazing creativity.", | |
| "incognito": "split", | |
| "icons": { | |
| "16": "16.jpg", | |
| "48": "48.jpg", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ create-react-app endoplazmik-retikulum | |
| $ cd endoplazmik-retikulum | |
| $ npm start |