From f0c03a9b8e15387c4defd0a0e3e0298324406fae Mon Sep 17 00:00:00 2001 From: flu0r1ne Date: Mon, 28 Aug 2023 21:33:44 -0500 Subject: Add wg2nd --- components/Box/index.tsx | 18 ++++++ components/Breadcrumbs/index.tsx | 12 +++- components/Button/index.tsx | 39 ++++++++++++ components/Input/index.tsx | 22 +++++++ components/Markdown/index.tsx | 4 +- components/TextArea/index.tsx | 22 +++++++ components/Typography/index.tsx | 47 +++++++++++++++ components/Typography/typo.module.scss | 64 ++++++++++++++++++++ components/ViewPort/index.tsx | 3 +- components/utils/inputElementStyle.tsx | 16 +++++ components/utils/systemProps.tsx | 107 +++++++++++++++++++++++++++++++++ 11 files changed, 348 insertions(+), 6 deletions(-) create mode 100644 components/Box/index.tsx create mode 100644 components/Button/index.tsx create mode 100644 components/Input/index.tsx create mode 100644 components/TextArea/index.tsx create mode 100644 components/Typography/index.tsx create mode 100644 components/Typography/typo.module.scss create mode 100644 components/utils/inputElementStyle.tsx create mode 100644 components/utils/systemProps.tsx (limited to 'components') diff --git a/components/Box/index.tsx b/components/Box/index.tsx new file mode 100644 index 0000000..32866b2 --- /dev/null +++ b/components/Box/index.tsx @@ -0,0 +1,18 @@ +import { getSystemStyle, SystemProps } from '../utils/systemProps'; + +interface BoxProps extends SystemProps { + style?: React.CSSProperties; + children?: React.ReactNode; +}; + +const Box: React.FC = ({ style, children, ...props}) => { + const systemStyle = getSystemStyle(props, style); + + return ( +
+ { children } +
+ ); +}; + +export default Box; diff --git a/components/Breadcrumbs/index.tsx b/components/Breadcrumbs/index.tsx index c5a17b8..d773b33 100644 --- a/components/Breadcrumbs/index.tsx +++ b/components/Breadcrumbs/index.tsx @@ -6,6 +6,7 @@ import clsx from 'clsx'; export type BreadcrumbsProps = { className?: string; style?: object; + children: React.ReactNode; }; const Breadcrumbs : FC = ({children, className, ...props}) => ( @@ -25,7 +26,11 @@ const Breadcrumbs : FC = ({children, className, ...props}) => ); -const Crumb : FC = ({children, ...props}) => ( +export type CrumbProps = { + children: React.ReactNode; +}; + +const Crumb : FC = ({children, ...props}) => ( {children} @@ -33,12 +38,13 @@ const Crumb : FC = ({children, ...props}) => ( export type LinkCrumbProps = { href: string; + children: React.ReactNode; } const LinkCrumb : FC = ({children, href, ...props}) => ( - {children} + {children} ); @@ -47,4 +53,4 @@ export { Crumb, Breadcrumbs, LinkCrumb -}; \ No newline at end of file +}; diff --git a/components/Button/index.tsx b/components/Button/index.tsx new file mode 100644 index 0000000..9eb2e95 --- /dev/null +++ b/components/Button/index.tsx @@ -0,0 +1,39 @@ +import React, { TextareaHTMLAttributes } from 'react'; +import { getSystemStyle, SystemProps } from '../utils/systemProps'; + +interface ButtonProps + extends React.ButtonHTMLAttributes, + SystemProps +{ } + +const Button: React.FC = ({ style, ...props }) => { + style = { + margin: '0.25rem 0.125rem', + cursor: 'pointer', + padding: '0.375rem 0.75rem', + borderRadius: '0.25rem', + textAlign: 'center', + verticalAlign: 'middle', + display: 'inline-block', + userSelect: 'none', + + fontFamily: 'inherit', + fontSize: '.95rem', + lineHeight: '1.15', + + // Color + color: '#fff', + backgroundColor: '#1473ff', + border: '1px solid #1473ff', + boxSizing: 'border-box', + + transition: 'color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out', + ...style, + }; + + const systemStyle = getSystemStyle(props, style); + + return (