Skip to content

Instantly share code, notes, and snippets.

View ebrugulec's full-sized avatar
💃

Ebru Gulec ebrugulec

💃
  • Berlin, Germany
View GitHub Profile
//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
//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 (
<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>
<amp-carousel
class="amp-carousel-slide"
controls="false"
on="slideChange:AMP.setState({
selected: {
<?php echo $product['id'] ?>:{
tab: event.index
}
}
})"
<?php
function tabs_amp_module()
{
$cssPath = 'Your css path';
if (file_exists($cssPath)) {
echo file_get_contents($cssPath);
}
}
<head>
<style amp-custom>
<?php
do_action("AMP_MODULE_CSS");
?>
</style>
</head>
<!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" />
{
"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",
$ create-react-app endoplazmik-retikulum
$ cd endoplazmik-retikulum
$ npm start