Skip to content

Instantly share code, notes, and snippets.

View Swiip's full-sized avatar

Matthieu Lux Swiip

View GitHub Profile
import React from "react";
import { string } from "prop-types";
import set from "lodash.set";
import { useSSR } from "react-i18next";
import i18n from "i18next";
import { useQuery } from "react-apollo-hooks";
import { gql } from "apollo-boost";
import i18next from "./i18next";
import { NamespaceProvider } from "./namespace";
@Swiip
Swiip / AgenciesMenu.js
Created March 19, 2019 16:55
components/company/__tests__/AgenciesMenu.js
import React from "react";
import { shallow } from "enzyme";
import Router from "next/router";
import AgenciesMenu from "../AgenciesMenu";
import { setAgencies, selectAgency } from "../../../logic/hooks/useAgencies";
const lyon = { slug: "lyon" };
const paris = { slug: "paris" };
const agencies = [lyon, paris];
@Swiip
Swiip / useAgencies.js
Created March 19, 2019 16:01
logic/hooks/useAgencies.js
import { useQuery } from "react-apollo-hooks";
import { gql } from "apollo-boost";
import { initAgencies, selectAgency } from "../agencies";
import useRedux from "./useRedux";
import useLoaded from "./useLoaded";
const agencyQuery = gql`
query Agencies { ... }
`;
Event {
time: 2019-02-08T16:50:50.280Z,
level: 'INFO',
event: [ 'call', 9007117650364516, 'hs_init' ] }
Event {
time: 2019-02-08T16:50:50.283Z,
level: 'INFO',
event:
[ 'store',
'i32',
@Swiip
Swiip / index.js
Last active June 19, 2018 07:30
Compo counter example
import {
html,
css,
createStore,
component,
withProp,
withStore,
withStyle,
withMarkup,
} from 'compo-lib';
import { component, css, html, withState, withStyle, withMarkup } from "MyIdealFramework";
const MyComponent = component(
withState(() => ({content: "hello world"})),
withStyle(props => css`color: red;`),
withMarkup(props => html`<div>${props.content}</div>`)
);
import React from "react";
import styled from "styled-components";
const StyledView = styled.View`
background-color: papayawhip;
`;
const StyledText = styled.Text`
color: palevioletred;
`;
import { injectGlobal } from "styled-components";
injectGlobal`
html {
background: #444;
}
`;
const BigBB8 = BB8.extend`
zoom: 200%;
@media (max-width: 700px) {
zoom: 150%;
}
@media (max-width: 500px) {
zoom: 100%;
}
import styled, { keyframes } from "styled-components";
const spin = keyframes`
0 { transform: rotate(0deg) translateZ(0); }
100% { transform: rotate(-360deg) translateZ(0); }
`;
const BB8 = styled.div`
&:before {
animation: ${({ turn }) =>