-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tailwindify #1394
base: main
Are you sure you want to change the base?
Tailwindify #1394
Changes from all commits
1d9a08c
95435ff
fd69fe2
31403e0
bcd5fc0
11e41ff
baa17aa
621c753
ffefc25
a2e3f40
9e8abed
b246608
2b9bf75
625738b
0ab258c
0570292
515f25a
d1b147e
bf777dc
711cb03
199845d
5bef576
c31cef6
7b8a98a
17dd28e
4713bcf
4367854
cbb45ef
6b2423a
f1c24f8
7f48c8b
4203075
5f47460
aeb0529
43cc316
2f6d9df
ff37469
bfbf38e
926efae
a06e8d8
0d5c6f3
963a5b9
aa7660c
97ebb18
9f4e474
e02505b
3506080
dd5311d
4585670
1b6b868
8adcfb4
3d55b72
bbced5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,28 @@ import basicSetup from "@/lib/codemirror/basic-setup"; | |
import { cpp } from "@/lib/codemirror/cpp"; | ||
import getTranslation from "@/lib/i18n/translate"; | ||
|
||
import styles from "./new.module.scss"; | ||
interface FormLabelProps { | ||
children: React.ReactNode; | ||
htmlFor?: string; | ||
small?: string; | ||
} | ||
|
||
function FormLabel({ children, htmlFor, small }: FormLabelProps) { | ||
const Tag = htmlFor ? "label" : "p"; | ||
return ( | ||
<Tag | ||
className="m-0 block p-2.5 font-semibold text-[0.9em] text-[color:var(--g1700)]" | ||
{...(htmlFor && { htmlFor })} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prefer ?? probably. doesnt matter because typescript but its more precise |
||
> | ||
{children} | ||
{small && ( | ||
<small className="pl-2 font-normal text-[0.8em] text-[color:var(--g800)]"> | ||
{small} | ||
</small> | ||
)} | ||
</Tag> | ||
); | ||
} | ||
|
||
function getLabels(asm: string): string[] { | ||
const lines = asm.split("\n"); | ||
|
@@ -260,7 +281,7 @@ export default function NewScratchForm({ | |
return ( | ||
<div> | ||
<div> | ||
<p className={styles.label}>Platform</p> | ||
<FormLabel>Platform</FormLabel> | ||
<PlatformSelect | ||
platforms={serverCompilers.platforms} | ||
value={platform} | ||
|
@@ -272,26 +293,28 @@ export default function NewScratchForm({ | |
</div> | ||
|
||
<div> | ||
<p className={styles.label}>Compiler</p> | ||
<div className={styles.compilerContainer}> | ||
<div> | ||
<span className={styles.compilerChoiceHeading}> | ||
<FormLabel>Compiler</FormLabel> | ||
<div className="flex cursor-default select-none items-center justify-between max-[400px]:flex-col"> | ||
<div className="flex w-full flex-1 flex-col"> | ||
<span className="px-2.5 py-0.5 text-[0.8rem] text-[color:var(--g800)]"> | ||
Select a compiler | ||
</span> | ||
<Select | ||
className={styles.compilerChoiceSelect} | ||
className="w-full" | ||
options={compilerChoiceOptions} | ||
value={compilerId} | ||
onChange={setCompiler} | ||
/> | ||
</div> | ||
<div className={styles.compilerChoiceOr}>or</div> | ||
<div> | ||
<span className={styles.compilerChoiceHeading}> | ||
<div className="flex-0 px-2 py-2 text-center text-[0.8rem] text-[color:var(--g500)] min-[400px]:px-4"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Surprised we don't have a tailwind config value for this: |
||
or | ||
</div> | ||
<div className="flex w-full flex-1 flex-col"> | ||
<span className="px-2.5 py-0.5 text-[0.8rem] text-[color:var(--g800)]"> | ||
Select a preset | ||
</span> | ||
<PresetSelect | ||
className={styles.compilerChoiceSelect} | ||
className="w-full" | ||
platform={platform} | ||
presetId={presetId} | ||
setPreset={setPreset} | ||
|
@@ -305,10 +328,12 @@ export default function NewScratchForm({ | |
</div> | ||
|
||
<div> | ||
<label className={styles.label} htmlFor="label"> | ||
Diff label{" "} | ||
<small>(asm label from which the diff will begin)</small> | ||
</label> | ||
<FormLabel | ||
htmlFor="label" | ||
small="(asm label from which the diff will begin)" | ||
> | ||
Diff label | ||
</FormLabel> | ||
<input | ||
name="label" | ||
type="text" | ||
|
@@ -317,34 +342,28 @@ export default function NewScratchForm({ | |
onChange={(e) => | ||
setLabel((e.target as HTMLInputElement).value) | ||
} | ||
className={styles.textInput} | ||
className="w-full rounded border border-[color:var(--g500)] bg-[color:var(--g200)] px-2.5 py-2 font-mono text-[0.8rem] text-[color:var(--g1200)] placeholder-[color:var(--g700)] outline-none" | ||
autoCorrect="off" | ||
autoCapitalize="off" | ||
spellCheck={false} | ||
/> | ||
</div> | ||
<div className={styles.editorContainer}> | ||
<p className={styles.label}> | ||
Target assembly <small>(required)</small> | ||
</p> | ||
<div className="flex h-[200px] flex-col"> | ||
<FormLabel small="(required)">Target assembly</FormLabel> | ||
<CodeMirror | ||
className={styles.editor} | ||
className="w-full flex-1 overflow-hidden rounded border border-[color:var(--g500)] bg-[color:var(--g200)] [&_.cm-editor]:h-full" | ||
value={asm} | ||
valueVersion={valueVersion} | ||
onChange={setAsm} | ||
extensions={basicSetup} | ||
/> | ||
</div> | ||
<div className={styles.editorContainer}> | ||
<p className={styles.label}> | ||
Context{" "} | ||
<small> | ||
(any typedefs, structs, and declarations you would like | ||
to include go here; typically generated with m2ctx.py) | ||
</small> | ||
</p> | ||
<div className="flex h-[200px] flex-col"> | ||
<FormLabel small="(any typedefs, structs, and declarations you would like to include go here; typically generated with m2ctx.py)"> | ||
Context | ||
</FormLabel> | ||
<CodeMirror | ||
className={styles.editor} | ||
className="w-full flex-1 overflow-hidden rounded border border-[color:var(--g500)] bg-[color:var(--g200)] [&_.cm-editor]:h-full" | ||
value={context} | ||
valueVersion={valueVersion} | ||
onChange={setContext} | ||
|
@@ -362,12 +381,18 @@ export default function NewScratchForm({ | |
> | ||
Create scratch | ||
</AsyncButton> | ||
<p className={styles.privacyNotice}> | ||
<p className="pt-4 text-[0.9rem] text-[color:var(--g1200)]"> | ||
decomp.me will store any data you submit and link it to your | ||
session. | ||
<br /> | ||
For more information, see our{" "} | ||
<Link href="/privacy">privacy policy</Link>. | ||
<Link | ||
href="/privacy" | ||
className="text-[color:var(--link)] hover:underline" | ||
> | ||
privacy policy | ||
</Link> | ||
. | ||
</p> | ||
</div> | ||
</div> | ||
|
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call this
htmlEl
(i.e. element) rather thanhtmlFor
because that has a very specific other meaning: https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/htmlFor