-
-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: select text modal for comments * feat: select text for posts * chore: remove unnecessary imports * refactor: move SelectText to shared * refactor: use styled for selectable text
- Loading branch information
1 parent
4303172
commit 9f9e8ba
Showing
4 changed files
with
83 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -51,4 +51,4 @@ ion-modal.small ion-header ion-toolbar:first-of-type { | |
|
||
ion-alert.preserve-newlines { | ||
white-space: pre-line; | ||
} | ||
} |
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,51 @@ | ||
import { | ||
IonHeader, | ||
IonToolbar, | ||
IonTitle, | ||
IonButtons, | ||
IonButton, | ||
IonContent, | ||
IonPage, | ||
} from "@ionic/react"; | ||
import { useRef } from "react"; | ||
import { Centered } from "../../features/auth/Login"; | ||
import styled from "@emotion/styled"; | ||
|
||
interface SelectTextProps { | ||
text: string; | ||
onDismiss: (data?: string | null | undefined | number, role?: string) => void; | ||
} | ||
|
||
const SelectableText = styled.p` | ||
user-select: text; | ||
-webkit-user-select: text; | ||
white-space: pre-wrap; | ||
`; | ||
|
||
export default function SelectText({ text, onDismiss }: SelectTextProps) { | ||
const pageRef = useRef(); | ||
|
||
return ( | ||
<IonPage ref={pageRef}> | ||
<IonHeader> | ||
<IonToolbar> | ||
<IonTitle> | ||
<Centered>Select Text</Centered> | ||
</IonTitle> | ||
<IonButtons slot="end"> | ||
<IonButton | ||
onClick={() => { | ||
onDismiss(); | ||
}} | ||
> | ||
Dismiss | ||
</IonButton> | ||
</IonButtons> | ||
</IonToolbar> | ||
</IonHeader> | ||
<IonContent> | ||
<SelectableText>{text}</SelectableText> | ||
</IonContent> | ||
</IonPage> | ||
); | ||
} |