Skip to content

Instantly share code, notes, and snippets.

@nicolasleal570
Created September 10, 2020 05:50
Show Gist options
  • Save nicolasleal570/a79aaf3270ad46e20bd89fac9cac3610 to your computer and use it in GitHub Desktop.
Save nicolasleal570/a79aaf3270ad46e20bd89fac9cac3610 to your computer and use it in GitHub Desktop.
import React from "react";
interface Props {
title: string;
values: Array<{ field: string; value: string }>;
editButtonClick: () => void;
}
export default function ({ title, values, editButtonClick }: Props) {
return (
<div className="ReviewCard">
<div className="ReviewTitle">
<h3 className="">{title}</h3>
<button onClick={editButtonClick}>Edit</button>
</div>
<ul className="ReviewList">
{values.map(({ field, value }) => (
<li key={field}>
<span>{field}:</span> <span>{value}</span>
</li>
))}
</ul>
</div>
);
}
import React from "react";
import { NavigationProps } from "react-hooks-helper";
interface Props {
navigation: NavigationProps;
withPrevious?: boolean;
}
export default function ({ navigation, withPrevious = false }: Props) {
const { next, previous } = navigation;
return (
<>
<div className="StepButtonBox">
{withPrevious && (
<button onClick={previous} className="StepButton secondary">
Prev
</button>
)}
<button onClick={next} className="StepButton primary">
Next
</button>
</div>
</>
);
}
import React from "react";
import { SetForm } from "react-hooks-helper";
interface Props {
name: string;
value: string;
labelText: string;
placeholder: string;
id: string;
type: "text" | "password" | "email" | "tel";
onChange: SetForm;
}
export default function ({
name,
value,
labelText,
id,
type,
placeholder,
onChange
}: Props) {
return (
<div className="TextField">
<label htmlFor={id}>{labelText}</label>
<input
type={type}
id={id}
name={name}
value={value}
placeholder={placeholder}
onChange={(e) => onChange(e)}
/>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment