Skip to content

Commit

Permalink
Multiple component updates. See release notes v2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmcshinsky committed Jan 10, 2022
1 parent 22eb9dd commit 2579124
Show file tree
Hide file tree
Showing 25 changed files with 441 additions and 324 deletions.
10 changes: 5 additions & 5 deletions .storybook/public/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -10984,6 +10984,11 @@ select {
background-color: rgb(134 239 172 / var(--tw-bg-opacity));
}

.bg-green-200 {
--tw-bg-opacity: 1;
background-color: rgb(187 247 208 / var(--tw-bg-opacity));
}

.bg-blue-100 {
--tw-bg-opacity: 1;
background-color: rgb(219 234 254 / var(--tw-bg-opacity));
Expand Down Expand Up @@ -11478,11 +11483,6 @@ select {
background-color: rgb(220 252 231 / var(--tw-bg-opacity));
}

.bg-green-200 {
--tw-bg-opacity: 1;
background-color: rgb(187 247 208 / var(--tw-bg-opacity));
}

.bg-green-400 {
--tw-bg-opacity: 1;
background-color: rgb(74 222 128 / var(--tw-bg-opacity));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "slipstream-ui",
"author": "Michael McShinsky",
"description": "Component library combining React and Tailwindcss, built with TypeScript",
"version": "2.1.1",
"version": "2.2.1",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
10 changes: 5 additions & 5 deletions src/assets/css/tailwind.output.css
Original file line number Diff line number Diff line change
Expand Up @@ -10984,6 +10984,11 @@ select {
background-color: rgb(134 239 172 / var(--tw-bg-opacity));
}

.bg-green-200 {
--tw-bg-opacity: 1;
background-color: rgb(187 247 208 / var(--tw-bg-opacity));
}

.bg-blue-100 {
--tw-bg-opacity: 1;
background-color: rgb(219 234 254 / var(--tw-bg-opacity));
Expand Down Expand Up @@ -11478,11 +11483,6 @@ select {
background-color: rgb(220 252 231 / var(--tw-bg-opacity));
}

.bg-green-200 {
--tw-bg-opacity: 1;
background-color: rgb(187 247 208 / var(--tw-bg-opacity));
}

.bg-green-400 {
--tw-bg-opacity: 1;
background-color: rgb(74 222 128 / var(--tw-bg-opacity));
Expand Down
40 changes: 22 additions & 18 deletions src/elements/heading/Heading.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactNode } from 'react';
import React, { forwardRef, ReactNode } from 'react';
import classNames from 'classnames';

export interface HeadingProps {
Expand All @@ -8,24 +8,28 @@ export interface HeadingProps {
children: ReactNode;
}

export function Heading(props: HeadingProps) {
const { level: Tag, custom, className, children, ...attrs } = props;
const classes = classNames(
!custom && Tag === 'h1' && 'text-3xl',
!custom && Tag === 'h2' && 'text-2xl',
!custom && Tag === 'h3' && 'text-xl',
!custom && Tag === 'h4' && 'text-lg',
!custom && Tag === 'h5' && 'text-base',
!custom && Tag === 'h6' && 'text-sm',
className,
);
return (
<Tag {...attrs} className={classes}>
{children}
</Tag>
);
}
export const Heading = forwardRef<HTMLHeadingElement, HeadingProps>(
({ level: Tag, custom, className, children, ...props }, ref) => {
const classes = classNames(
'sui--heading',
!custom && Tag === 'h1' && 'text-3xl',
!custom && Tag === 'h2' && 'text-2xl',
!custom && Tag === 'h3' && 'text-xl',
!custom && Tag === 'h4' && 'text-lg',
!custom && Tag === 'h5' && 'text-base',
!custom && Tag === 'h6' && 'text-sm',
className
);

return (
<Tag ref={ref} className={classes} {...props}>
{children}
</Tag>
);
}
);

Heading.displayName = 'Heading';
Heading.defaultProps = {
level: 'h2',
custom: false,
Expand Down
22 changes: 18 additions & 4 deletions src/elements/text/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
import React, { ReactNode } from 'react';
import React, { forwardRef, ReactNode } from 'react';
import classNames from 'classnames';

export interface TextProps {
children: ReactNode;
className?: string;
}

export function Text({ children, ...props }: TextProps) {
return <p {...props}>{children}</p>;
}
export const Text = forwardRef<HTMLParagraphElement, TextProps>(
({ children, className, ...props }, ref) => {
const classes = classNames('sui--text', className);

return (
<p ref={ref} className={classes} {...props}>
{children}
</p>
);
}
);

Text.displayName = 'Text';

export default Text;
47 changes: 22 additions & 25 deletions src/forms/field-set/FieldSet.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactNode } from 'react';
import React, { forwardRef, ReactNode } from 'react';
import classNames from 'classnames';

export interface FieldSetProps {
Expand All @@ -8,32 +8,29 @@ export interface FieldSetProps {
custom?: boolean;
}

export function FieldSet({
className,
styles,
children,
custom,
}: FieldSetProps) {
const classes = classNames(
'sui--fieldset',
!custom && 'block py-2 px-3 border border-solid border-gray-300',
className,
);
export const FieldSet = forwardRef<HTMLFieldSetElement, FieldSetProps>(
({ className, styles, children, custom, ...props }, ref) => {
const classes = classNames(
'sui--fieldset',
!custom && 'block py-2 px-3 border border-solid border-gray-300',
className
);

const fieldsetStyles = !custom
? {
marginInlineStart: '2px',
marginInlineEnd: '2px',
...styles,
}
: { ...styles };
const fieldsetStyles = !custom
? {
marginInlineStart: '2px',
marginInlineEnd: '2px',
...styles,
}
: { ...styles };

return (
<fieldset style={fieldsetStyles} className={classes}>
{children}
</fieldset>
);
}
return (
<fieldset ref={ref} style={fieldsetStyles} className={classes} {...props}>
{children}
</fieldset>
);
}
);

FieldSet.displayName = 'FieldSet';

Expand Down
22 changes: 13 additions & 9 deletions src/forms/field-set/FieldSetLegend.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactNode } from 'react';
import React, { forwardRef, ReactNode } from 'react';
import classNames from 'classnames';

export interface FieldSetLegendProps {
Expand All @@ -7,18 +7,22 @@ export interface FieldSetLegendProps {
custom?: boolean;
}

export function FieldSetLegend({
className,
children,
custom,
}: FieldSetLegendProps) {
export const FieldSetLegend = forwardRef<
HTMLLegendElement,
FieldSetLegendProps
>(({ className, children, custom, ...props }, ref) => {
const classes = classNames(
'sui--fieldset-legend',
!custom && 'block px-1 text-sm -mx-0.5',
className,
className
);
return <legend className={classes}>{children}</legend>;
}

return (
<legend ref={ref} className={classes} {...props}>
{children}
</legend>
);
});

FieldSetLegend.displayName = 'FieldSetLegend';

Expand Down
30 changes: 15 additions & 15 deletions src/forms/form-feedback/FormFeedback.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactNode, HTMLAttributes } from 'react';
import React, { forwardRef, ReactNode, HTMLAttributes } from 'react';
import classNames from 'classnames';

export interface FormFeedbackProps extends HTMLAttributes<HTMLDivElement> {
Expand All @@ -7,21 +7,21 @@ export interface FormFeedbackProps extends HTMLAttributes<HTMLDivElement> {
children: ReactNode;
}

export function FormFeedback(props: FormFeedbackProps) {
const { className, valid, children, ...attrs } = props;
export const FormFeedback = forwardRef<HTMLDivElement, FormFeedbackProps>(
({ className, valid, children, ...props }, ref) => {
const classes = classNames(
'sui--form-feedback text-sm',
valid ? 'text-green-500' : 'text-red-500',
className
);

const classes = classNames(
'sui--form-feedback text-sm',
valid ? 'text-green-500' : 'text-red-500',
className,
);

return (
<div className={classes} {...attrs}>
{children}
</div>
);
}
return (
<div ref={ref} className={classes} {...props}>
{children}
</div>
);
}
);

FormFeedback.displayName = 'FormFeedback';

Expand Down
Loading

0 comments on commit 2579124

Please sign in to comment.