/**
* Demo components for docs
*/
import React from "react";
import * as typestyle from "typestyle";
import * as gls from "..";
export const Star: React.FC = () => {
const link = "https://ghbtns.com/github-btn.html?user=basarat&repo=gls&type=star&count=true"
return (
);
}
export const BlueDiv: React.FC = (props) => ;
export const PinkDiv: React.FC = (props) => ;
/**
* Label
*/
const labelClass = typestyle.style({
});
export const Label: React.FC = (props) => {
return ;
}
/**
* Input
*/
const inputClass = typestyle.style({
width: 'calc(100% - 5px)' /** Docz weirdness */,
fontSize: '20px',
});
export const Input: React.FC = (_props) => {
return ;
}
/**
* Button
*/
export const buttonClass = typestyle.style(
{
fontFamily: 'helvetica',
cursor: 'pointer',
height: 'auto',
padding: "12px 30px 11px",
border: `1px solid #333`,
borderRadius: '3px',
color: `white`,
backgroundColor: '#333',
fontSize: '15px',
textDecoration: "none",
lineHeight: "1em",
outline: 'none',
transition: 'color .2s, background-color .2s',
display: 'inline-block',
$nest: {
'&:hover': {
backgroundColor: '#666',
},
'&:active': {
backgroundColor: '#666',
},
'&:focus': {
outline: 'thin dotted',
outlineColor: `#333`
}
}
});
export const Button
= (props: React.HTMLProps) => {
const { className, ...otherProps } = props;
return (
);
};
export const DemoProfile: React.FC<{ size: number }> = ({ size }) => {
return (
);
}
/**
* Example creating a button component
*/
export interface OnlySomeProps extends
React.ButtonHTMLAttributes,
gls.SizeProps {
}
export const OnlySomePropsButton: React.FC = (props) => {
const processedProps = gls.component(props);
return ;
}
export interface AllTheProps extends
React.ButtonHTMLAttributes,
gls.ComponentProps {
}
export const AllThePropsButton: React.FC = (props) => {
const processedProps = gls.component(props);
return ;
}
export interface LimitedButtonProps extends
gls.ComponentProps {
/** Turns red if in error state */
error?: boolean
}
export const LimitedButton: React.FC = (props) => {
/**
* Generates a className from component props
* + returns the rest
**/
const { className, error } = gls.component(props);
/** Handle the error */
const errorStyle = error ? { backgroundColor: 'red' } : {};
return ;
}
/**
* Example creating a default component prop
*/
export interface DefaultInputProps extends
React.InputHTMLAttributes,
gls.ComponentProps {
}
export const DefaultInput: React.FC = (props) => {
const { className, ...otherProps } =
gls.component(props, { sizing: 'stretch' });
return
};
/**
* Example creating an input component
*/
export interface ExampleInputProps extends
React.InputHTMLAttributes,
gls.ComponentProps {
}
export const ExampleInput: React.FC = (props) => {
const { className, ...otherProps } =
gls.component(props, { sizing: 'stretch' });
return
};