fix: enable to select text in buttons

This commit is contained in:
Shusui MOYATANI
2023-10-12 03:42:32 +09:00
parent 1e374dad2c
commit e37763ebc7
7 changed files with 13 additions and 12 deletions

View File

@@ -48,7 +48,7 @@ const Post: Component<PostProps> = (props) => {
<div class="flex justify-between gap-1 text-xs">
<button
type="button"
class="author flex min-w-0 truncate hover:text-blue-500"
class="author flex min-w-0 select-text truncate hover:text-blue-500"
onClick={(ev) => {
ev.preventDefault();
props?.onShowProfile?.();
@@ -74,7 +74,7 @@ const Post: Component<PostProps> = (props) => {
<div class="created-at shrink-0">
<button
type="button"
class="hover:underline"
class="select-text hover:underline"
onClick={(ev) => {
ev.preventDefault();
props.onShowEvent?.();

View File

@@ -1,4 +1,4 @@
import { Component, Show, Switch, Match } from 'solid-js';
import { Component, Show } from 'solid-js';
import useProfile from '@/nostr/useProfile';
import npubEncodeFallback from '@/utils/npubEncodeFallback';
@@ -9,7 +9,7 @@ export type ProfileListItemProps = {
};
const ProfileListItem: Component<ProfileListItemProps> = (props) => {
const { profile, query } = useProfile(() => ({
const { profile } = useProfile(() => ({
pubkey: props.pubkey,
}));
@@ -31,7 +31,7 @@ const ProfileListItem: Component<ProfileListItemProps> = (props) => {
<div class="flex justify-between gap-1 text-xs">
<button
type="button"
class="profile flex min-w-0 truncate hover:text-blue-500"
class="profile flex min-w-0 select-text truncate hover:text-blue-500"
onClick={(ev) => {
ev.preventDefault();
props?.onShowProfile?.();

View File

@@ -56,7 +56,7 @@ const ReactionDisplay: Component<ReactionDisplayProps> = (props) => {
</div>
<div class="flex-1 overflow-hidden">
<button
class="truncate font-bold hover:text-blue-500 hover:underline"
class="select-text truncate font-bold hover:text-blue-500 hover:underline"
onClick={() => showProfile(props.event.pubkey)}
>
<UserDisplayName pubkey={props.event.pubkey} />

View File

@@ -31,7 +31,7 @@ const Repost: Component<RepostProps> = (props) => {
</div>
<div class="flex-1 truncate break-all">
<button
class="hover:text-blue-500 hover:underline"
class="select-text hover:text-blue-500 hover:underline"
onClick={() => showProfile(props.event.pubkey)}
>
<UserDisplayName pubkey={props.event.pubkey} />

View File

@@ -1,8 +1,6 @@
import GeneralUserMentionDisplay from '@/components/event/textNote/GeneralUserMentionDisplay';
import useModalState from '@/hooks/useModalState';
import type { MentionedUser } from '@/nostr/parseTextNote';
export type MentionedUserDisplayProps = {
pubkey: string;
};
@@ -14,7 +12,7 @@ const MentionedUserDisplay = (props: MentionedUserDisplayProps) => {
showProfile(props.pubkey);
};
return (
<button class="inline text-blue-500 underline" onClick={handleClick}>
<button class="inline select-text text-blue-500 underline" onClick={handleClick}>
<GeneralUserMentionDisplay pubkey={props.pubkey} />
</button>
);

View File

@@ -98,7 +98,10 @@ const TextNoteContentDisplay = (props: TextNoteContentDisplayProps) => {
}
if (item.type === 'HashTag') {
return (
<button class="text-blue-500 underline" onClick={() => addHashTagColumn(item.content)}>
<button
class="select-text text-blue-500 underline"
onClick={() => addHashTagColumn(item.content)}
>
{item.content}
</button>
);

View File

@@ -347,7 +347,7 @@ const TextNoteDisplay: Component<TextNoteDisplayProps> = (props) => {
<For each={event().taggedPubkeys()}>
{(replyToPubkey: string) => (
<button
class="pr-1 text-blue-500 hover:underline"
class="select-text pr-1 text-blue-500 hover:underline"
onClick={(ev) => {
ev.stopPropagation();
showProfile(replyToPubkey);