-
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
1 parent
e37da95
commit ad651ff
Showing
6 changed files
with
113 additions
and
291 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 was deleted.
Oops, something went wrong.
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,55 @@ | ||
import React from 'react' | ||
import { Protocol, Token } from 'transliteration/domain/token' | ||
import { isEnclosure } from 'transliteration/domain/type-guards' | ||
import DisplayToken from './DisplayToken' | ||
import { GlossWrapper } from './LineAccumulator' | ||
|
||
export class MarkableToken { | ||
readonly token: Token | ||
readonly index: number | ||
readonly isInGloss: boolean | ||
readonly protocol: Protocol | null = null | ||
readonly language: string | ||
readonly hasLeadingWhitespace: boolean | ||
|
||
constructor( | ||
token: Token, | ||
index: number, | ||
isInGloss: boolean, | ||
protocol: Protocol | null, | ||
language: string, | ||
hasLeadingWhitespace?: boolean | ||
) { | ||
this.token = token | ||
this.index = index | ||
this.isInGloss = isInGloss | ||
this.protocol = protocol | ||
this.language = language | ||
this.hasLeadingWhitespace = hasLeadingWhitespace || false | ||
} | ||
|
||
display(): JSX.Element { | ||
return ( | ||
<> | ||
{this.hasLeadingWhitespace && ' '} | ||
<DisplayToken | ||
token={this.token} | ||
bemModifiers={ | ||
this.protocol === null | ||
? [this.language] | ||
: [ | ||
this.language, | ||
this.protocol.replace('!', 'commentary-protocol-'), | ||
] | ||
} | ||
Wrapper={ | ||
this.isInGloss && !isEnclosure(this.token) | ||
? GlossWrapper | ||
: undefined | ||
} | ||
isInPopover={true} | ||
/> | ||
</> | ||
) | ||
} | ||
} |
Oops, something went wrong.