-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
127 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.boxes-box { | ||
display: flex; | ||
flex-direction: column; | ||
margin: 2px 2px 0px 2px; | ||
} | ||
|
||
.boxes-children { | ||
flex: 1; | ||
display: flex; | ||
flex-direction: row; | ||
margin: 2px 2px 0px 2px; | ||
} | ||
|
||
.boxes-label { | ||
font-size: 10px; | ||
margin: 2px 4px; | ||
} | ||
|
||
.boxes-toaq { | ||
flex: 1; | ||
display: flex; | ||
font-weight: bold; | ||
justify-content: center; | ||
align-items: end; | ||
margin: 2px 4px 8px 4px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { ReactElement, useState, useEffect, ReactNode } from 'react'; | ||
import { BoxClause, BoxSentence, PostField } from '../boxes'; | ||
import './Boxes.css'; | ||
|
||
interface BoxProps { | ||
color: string; | ||
label: string; | ||
children: ReactNode; | ||
} | ||
|
||
function Box(props: BoxProps) { | ||
const { color, label, children } = props; | ||
return ( | ||
<div | ||
className="boxes-box" | ||
style={{ | ||
// border: `2px solid ${color}`, | ||
background: `color-mix(in srgb, ${color}, white 80%)`, | ||
}} | ||
> | ||
<div className="boxes-label">{label}</div> | ||
<div className="boxes-children">{children}</div> | ||
</div> | ||
); | ||
} | ||
|
||
function PostFieldBox(props: { postField: PostField }) { | ||
const { earlyAdjuncts, arguments: args, lateAdjuncts } = props.postField; | ||
if (earlyAdjuncts.length + args.length + lateAdjuncts.length === 0) { | ||
return undefined; | ||
} | ||
return ( | ||
<Box color="#ffcc00" label="Post-field"> | ||
{earlyAdjuncts.map((a, i) => ( | ||
<Box key={i} color="purple" label="Adjunct"> | ||
<div className="boxes-toaq">{a}</div> | ||
</Box> | ||
))} | ||
{args.map((a, i) => ( | ||
<Box key={i} color="teal" label="Argument"> | ||
<div className="boxes-toaq">{a}</div> | ||
</Box> | ||
))} | ||
{lateAdjuncts.map((a, i) => ( | ||
<Box key={i} color="purple" label="Adjunct"> | ||
<div className="boxes-toaq">{a}</div> | ||
</Box> | ||
))} | ||
</Box> | ||
); | ||
} | ||
|
||
function ClauseBox(props: { clause: BoxClause }) { | ||
const { complementizer, topic, verbalComplex, postField } = props.clause; | ||
return ( | ||
<Box color="red" label="Clause"> | ||
<Box color="orange" label="Comp."> | ||
<div className="boxes-toaq">{complementizer}</div> | ||
</Box> | ||
{topic && ( | ||
<Box color="aqua" label="Topic"> | ||
<div className="boxes-toaq">{topic}</div> | ||
</Box> | ||
)} | ||
<Box color="green" label="Verbal complex"> | ||
<div className="boxes-toaq">{verbalComplex}</div> | ||
</Box> | ||
<PostFieldBox postField={postField} /> | ||
</Box> | ||
); | ||
} | ||
|
||
export function Boxes(props: { sentence: BoxSentence }) { | ||
const { clause, speechAct } = props.sentence; | ||
return ( | ||
<Box color="blue" label="Sentence"> | ||
<ClauseBox clause={clause} /> | ||
<Box color="gray" label="Speech act"> | ||
<div className="boxes-toaq">{speechAct}</div> | ||
</Box> | ||
</Box> | ||
); | ||
} |