Skip to content

Instantly share code, notes, and snippets.

View dimitrisnl's full-sized avatar
🆗
Computer

Dimitrios Lytras dimitrisnl

🆗
Computer
View GitHub Profile
const Link = (props) => {
let className = `link link--${props.theme}-theme`;
if (!props.underline) className += ' link--no-underline';
return <a href={props.href} className={className}>{props.children}</a>;
};
Link.propTypes = {
theme: PropTypes.oneOf([
.
├─ src
│ ├─ assets/
│ │ ├─ fonts/
│ │ ├─ styles/
│ │ │ ├─ partials/
│ │ │ │ ├─ _common.scss # Common styling, e.g anchors.
│ │ │ │ ├─ (_tables.scss) # Element stylings that get too lengthy
│ │ │ │ ├─ _layout.scss # CSS not suitable in layout/components scoped css
│ │ │ │ ├─ _helpers.scss # If not using bootstrap 4 helpers
import axios from 'axios'
import qs from 'qs'
const API_URL = process.env.API_URL
// const OTHER_API_URL = pricess.env.OTHER_API_URL
axios.defaults.headers.common.Accept = 'application/json'
// Instances -----------------------------------------
export const apiService = axios.create({
import { apiService } from 'utils/api'
export const requestMemberInterests = (params) => {
return apiService.get(`/path/to/happiness`, { params })
}
export const requestMemberSubscriptions = (params) => {
return apiService.get(`/path/to/happiness`, { params })
}
import * as dropdowns from 'utils/api/dropdowns'
// ...
async getMemberCategories ({ commit }, params) {
const response = await dropdowns.requestMemberSubscriptions(params)
commit('setMemberCategories', response.data)
}
// ..
router.beforeEach((to, from, next) => {
if ( !to.meta.requiresAuth || store.state.user.authenticated){
next();
}
else{
next({ name: 'landing' })
}
})
// {
Tennis/
Friendly/
_routes.js
..
Lessons/
_routes.js
..
Tournaments/
Tournament/
_routes.js
import Overview from './TournamentOverview'
import Participants from './TournamentParticipants'
import Settings from './TourmamentSettings'
export default [
{
path: '',
name: 'tournament-overview',
component: Overview,
meta: {
import List from './TournamentsList'
import Single from './Tournament'
import tournamentRoutes from './Tournament/routes'
export default [
{
path: '',
name: 'tournaments-list',
component: List,
@dimitrisnl
dimitrisnl / header.js
Last active May 19, 2019 16:37
Tailwind Header in React
import React, { useState, useCallback } from 'react';
import { Link } from 'gatsby';
import styled from '@emotion/styled';
import tw from 'tailwind.macro';
const Dropdown = styled.div`
${tw`w-full flex-grow lg:flex lg:items-center lg:justify-end lg:w-auto`}
`;
const NavLinks = () => (