This file contains 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
export default { | |
bucket: { | |
slug: process.env.COSMIC_BUCKET || 'coffee-blog', | |
read_key: process.env.COSMIC_READ_KEY || '', | |
write_key: process.env.COSMIC_WRITE_KEY || '', | |
port: process.env.PORT || '', | |
} | |
} |
This file contains 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
import path from 'path' | |
import axios from 'axios' | |
import config from './config' | |
const gph_query = `{ | |
getObjects(bucket_slug: "${config.bucket.slug}", input: { | |
type: "posts", | |
limit: 20, | |
read_key: "${config.bucket.read_key}", | |
}) { |
This file contains 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
* { | |
scroll-behavior: smooth; | |
} | |
body { | |
font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', | |
Helvetica, Arial, 'Lucida Grande', sans-serif; | |
font-weight: 300; | |
font-size: 16px; | |
margin: 0; |
This file contains 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
<Root> | |
<header className="header"> | |
<h1 className="header-h1">React-Static & Cosmic JS blog</h1> | |
<nav className="header-nav"> | |
<Link getProps={isActive} className="header-link" to="/"> | |
Home | |
</Link> | |
<Link getProps={isActive} className="header-link" to="/about"> | |
About | |
</Link> |
This file contains 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
import React from 'react' | |
import {withRouteData} from 'react-static' | |
import {Link } from '@reach/router' | |
export default withRouteData(({posts}) =>( | |
<React.Fragment> | |
<div className="container"> | |
{posts.map(post => ( | |
<Link key={post._id} to={`/post/${post._id}`} className="card"> | |
<div style={{ paddingRight: "1em" }}> |
This file contains 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
import React from 'react' | |
import {withRouteData} from 'react-static' | |
import Markdown from "react-markdown"; | |
import { Link } from 'components/Router' | |
export default withRouteData(({post}) => ( | |
<React.Fragment> | |
<div className="content"> | |
<Link to="/">{'<'} Back</Link> | |
</div> |
This file contains 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
export default { | |
bucket: { | |
slug: 'COSMIC_BUCKET', | |
read_key: 'COSMIC_READ_KEY', | |
write_key: 'COSMIC_WRITE_KEY', | |
port: 'PORT', | |
} | |
} |
This file contains 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
import svelte from 'rollup-plugin-svelte'; | |
import resolve from 'rollup-plugin-node-resolve'; | |
import commonjs from 'rollup-plugin-commonjs'; | |
import livereload from 'rollup-plugin-livereload'; | |
import { terser } from 'rollup-plugin-terser'; | |
import replace from 'rollup-plugin-replace'; | |
const production = !process.env.ROLLUP_WATCH; | |
export default { |
This file contains 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
<script> | |
import { onMount } from "svelte"; | |
import axios from "axios"; | |
import config from "./config.js"; | |
import TodoItem from "./TodoItem.svelte"; | |
export let name; | |
let todo = ""; | |
$: todos = []; | |
onMount(getTodos()); | |
function getTodos() { |
This file contains 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
<script> | |
import { createEventDispatcher } from 'svelte'; | |
export let todo; | |
const dispatch = createEventDispatcher(); | |
function deleteTodo() { | |
dispatch('deleteTodo', { | |
todo: todo | |
}); | |
} | |
function toggleComplete() { |
OlderNewer