Open seanh opened 3 days ago
A few general things about JSX and Preact components:
className
instead of class
and htmlFor
instead of for
. Both the JSX and HTML names work in Preact, but the JSX ones are standard<div className="foo"/>
instead of <div className="foo"></div>
useId
hook:import { useId } from 'preact/hooks';
function Widget() {
const fooId = useId();
return <>
<label htmlFor={fooId}>Some field</label>
<input id={fooId}/>
</>
}
function CharCounter({ value, limit }: { value: number; limit: number }) {
return (
<div className="flex">
<div className="grow" />
<span className="text-grey-6">
{value}/{limit}
</span>
</div>
);
}
...
<CharCounter value={0} limit={250}/>
Some notes about styling:
div
s around the right-aligned elements.text-brand
for red, text-grey-6
for labels / counter / footnote and also the bottom divider, text-grey-7
for the heading. The component library uses more variety for heading sizes and colors than I think it should, so we'll need to tweak that.text-sm
for all the body text and text-xl
for the heading. text-sm
works out to be 14px by default, which is also GitHub's standard body text size. This is one pixel larger than the 13px that hypothes.is currently uses.
Style the new create-group-form to look similar to the legacy one, but using Tailwind for CSS.
This involves a lot of hard-coded values that we'll probably want to replace.