-
Notifications
You must be signed in to change notification settings - Fork 339
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
578709b
commit 1f15ea5
Showing
11 changed files
with
877 additions
and
52 deletions.
There are no files selected for viewing
Submodule lemmy-translations
updated
2 files
+1 −12 | translations/en.json | |
+49 −86 | translations/ja.json |
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,33 @@ | ||
import { Component } from "inferno"; | ||
import { getEmojiMart } from "../../utils"; | ||
|
||
|
||
interface EmojiMartProps { | ||
onEmojiClick?(val: any): any; | ||
pickerOptions: any; | ||
} | ||
|
||
export class EmojiMart extends Component< | ||
EmojiMartProps | ||
> { | ||
constructor(props: any, context: any) { | ||
super(props, context); | ||
this.handleEmojiClick = this.handleEmojiClick.bind(this); | ||
} | ||
componentDidMount() { | ||
let div: any = document.getElementById("emoji-picker"); | ||
if (div) { | ||
div.appendChild(getEmojiMart(this.handleEmojiClick, this.props.pickerOptions)); | ||
} | ||
} | ||
|
||
render() { | ||
return ( | ||
<div id="emoji-picker"></div> | ||
); | ||
} | ||
|
||
handleEmojiClick(e: any) { | ||
this.props.onEmojiClick?.(e); | ||
} | ||
} |
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,62 @@ | ||
import { Component, linkEvent } from "inferno"; | ||
import { i18n } from "../../i18next"; | ||
import { EmojiMart } from "./emoji-mart"; | ||
import { Icon } from "./icon"; | ||
|
||
interface EmojiPickerProps { | ||
onEmojiClick?(val: any): any; | ||
} | ||
|
||
interface EmojiPickerState { | ||
showPicker: boolean, | ||
} | ||
|
||
export class EmojiPicker extends Component< | ||
EmojiPickerProps, | ||
EmojiPickerState | ||
> { | ||
private emptyState: EmojiPickerState = { | ||
showPicker: false, | ||
}; | ||
state: EmojiPickerState; | ||
constructor(props: any, context: any) { | ||
super(props, context); | ||
this.state = this.emptyState; | ||
this.handleEmojiClick = this.handleEmojiClick.bind(this); | ||
} | ||
render() { | ||
return ( | ||
<span> | ||
<button | ||
className="btn btn-sm text-muted" | ||
data-tippy-content={i18n.t("emoji")} | ||
aria-label={i18n.t("emoji")} | ||
onClick={linkEvent(this,this.togglePicker)} | ||
> | ||
<Icon icon="smile" classes="icon-inline" /> | ||
</button> | ||
|
||
{this.state.showPicker && ( | ||
<> | ||
<div className="emoji-picker-container"> | ||
<EmojiMart onEmojiClick={this.handleEmojiClick} pickerOptions={({})}></EmojiMart> | ||
</div> | ||
<div | ||
onClick={linkEvent(this,this.togglePicker)} | ||
className="click-away-container" | ||
/> | ||
</> | ||
)} | ||
</span> | ||
); | ||
} | ||
|
||
togglePicker(i: EmojiPicker, e: any) { | ||
e.preventDefault(); | ||
i.setState({ showPicker: !i.state.showPicker }); | ||
} | ||
|
||
handleEmojiClick(e: any) { | ||
this.props.onEmojiClick?.(e); | ||
} | ||
} |
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
Oops, something went wrong.