interface WateringType {
id: string | number;
user: string;
literAmount: number;
}
interface WateringListPropType {
waterings: WateringType[];
}
export const WateringList: React.FC<WateringListPropType> = ({
waterings,
}) => (
<ul>
{waterings.map(({ id, user, literAmount }) => (
<li key={id}>{`${user}: ${literAmount}l`}</li>
))}
</ul>
);
visibleMapLayer
= Filtered GeoJSON
mapViewFilter
Bonus: focusPoint
interface ExpandableTextPropType {
title: string
}
export const ExpandableText: React.FC<ExpandableTextPropType> = ({
title,
children,
}) => {
const [isExpanded, setIsExpanded] = useState(false);
const toggleIsExpanded = (): void => setIsExpanded(!isExpanded);
return (
<div>
<button onClick={toggleIsExpanded}>
{title}
<button>
{isExpanded && <p>{children}</p>}
</div>
);
};
const SidebarToggle: FC = () => {
const isSidebarOpened = useStoreState("isSidebarOpened");
const { toggleSidebar } = useActions();
return (
<button onClick={toggleSidebar}>
{isSidebarOpened ? "Close" : "Open"}
</button>
);
};type ItemsType = any[] | undefined;
const reactQueryOptions = {
staleTime: Infinity,
refetchOnWindowFocus: false,
};
const useItems = () => {
const { data: items, error } = useQuery<ItemsType[], Error>(
"items",
asynchronouslyFetchItems,
reactQueryOptions
);
return { error, items };
};
# Mapbox Token
MAPBOX_API_KEY="pk.123.xyz"
# Auth0
AUTH0_DOMAIN="myauthzeropath.eu.auth0.com"
AUTH0_CLIENT_ID="7479d17d-2212-4a23-a42c-363b898dc618"
AUTH0_AUDIENCE="https://my-tree-api-url.io"
# User management
USER_DATA_API_URL="https://my-user-management-api.io"
# Gieß den Kiez API
API_ENDPOINT="https://localhost:8000/my-local-postgres-api"
[build]
command = "node ./create-env.js && npm run build"
publish = "dist/"
[build.environment]
BUILD_TARGET = "DEFAULT"
[context.demo]
command = "node ./create-env.js && npm run build"
# environment = {BUILD_TARGET = "DEMO", NODE_ENV = "production"}
publish = "dist/"
[context.demo.environment]
...const SmallParagraphContainer = styled.p`
line-height: 150%;
font-size: ${p => p.theme.fontSizeL};
opacity: 0.66;
letter-spacing: 0.125px;
padding: 0;
margin: 0;
font-weight: normal;
a {
color: ${p => p.theme.colorTextDark};
transition: opacity 200ms ease-out;
opacity: 1;
}
a:hover {
opacity: 0.33;
}
`;const SmallParagraphContainer = styled.p`
line-height: 150%;
font-size: ${p => p.theme.fontSizeL};
opacity: 0.66;
letter-spacing: 0.125px;
padding: 0;
margin: 0;
font-weight: normal;
a {
color: ${p => p.theme.colorTextDark};
transition: opacity 200ms ease-out;
opacity: 1;
}
a:hover {
opacity: 0.33;
}
`;const SmallParagraphContainer = styled.p`
line-height: 150%;
font-size: ${p => p.theme.fontSizeL};
opacity: 0.66;
letter-spacing: 0.125px;
padding: 0;
margin: 0;
font-weight: normal;
a {
color: ${p => p.theme.colorTextDark};
transition: opacity 200ms ease-out;
opacity: 1;
}
a:hover {
opacity: 0.33;
}
`;const SmallParagraphContainer = styled.p`
line-height: 150%;
font-size: ${p => p.theme.fontSizeL};
opacity: 0.66;
letter-spacing: 0.125px;
padding: 0;
margin: 0;
font-weight: normal;
a {
color: ${p => p.theme.colorTextDark};
transition: opacity 200ms ease-out;
opacity: 1;
}
a:hover {
opacity: 0.33;
}
`;const SmallParagraph = ({
children,
className = '',
onClick = () => undefined,
}) => (
<SmallParagraphContainer
className={className}
onClick={onClick}
>
{children}
</SmallParagraphContainer>
);const GlobalStyles = createGlobalStyle`
${styledNormalize}
body {
color: ${({ theme }) => theme.color};
font-family: 'IBM Plex Sans', sans-serif;
}
`;
const customTheme = { color: 'red' };
export const App: FC = ({ children }) => (
<ThemeProvider theme={customTheme}>
<GlobalStyles />
{children}
</ThemeProvider>
);
const GlobalStyles = createGlobalStyle`
${styledNormalize}
body {
color: ${({ theme }) => theme.color};
font-family: 'IBM Plex Sans', sans-serif;
}
`;
const customTheme = { color: 'red' };
export const App: FC = ({ children }) => (
<ThemeProvider theme={customTheme}>
<GlobalStyles />
{children}
</ThemeProvider>
);
const GlobalStyles = createGlobalStyle`
${styledNormalize}
body {
color: ${({ theme }) => theme.color};
font-family: 'IBM Plex Sans', sans-serif;
}
`;
const customTheme = { color: 'red' };
export const App: FC = ({ children }) => (
<ThemeProvider theme={customTheme}>
<GlobalStyles />
{children}
</ThemeProvider>
);
const GlobalStyles = createGlobalStyle`
${styledNormalize}
body {
color: ${({ theme }) => theme.color};
font-family: 'IBM Plex Sans', sans-serif;
}
`;
const customTheme = { color: 'red' };
export const App: FC = ({ children }) => (
<ThemeProvider theme={customTheme}>
<GlobalStyles />
{children}
</ThemeProvider>
);
npm run test:watch # or `npm run test:ci`
npm run type-check
npm run storybook