feat: add delete action to Messages component and enhance styling for better user experience
This commit is contained in:
parent
1a0edcd43a
commit
4dddc82c8c
|
@ -33,6 +33,10 @@ const Messages: React.FC<MessageProps> = ({ val, i }) => {
|
||||||
setIsEditing(false);
|
setIsEditing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDeleteAction() {
|
||||||
|
setOpenOptions(false);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isEditing ? (
|
{isEditing ? (
|
||||||
|
@ -87,7 +91,7 @@ const Messages: React.FC<MessageProps> = ({ val, i }) => {
|
||||||
<button
|
<button
|
||||||
className="more-options-button"
|
className="more-options-button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setOpenOptions(true);
|
setOpenOptions(!openOptions);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<KebabIcon />
|
<KebabIcon />
|
||||||
|
@ -97,12 +101,20 @@ const Messages: React.FC<MessageProps> = ({ val, i }) => {
|
||||||
<button
|
<button
|
||||||
className="option"
|
className="option"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
setOpenOptions(false);
|
||||||
setIsEditing(true);
|
setIsEditing(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Edit
|
Edit
|
||||||
</button>
|
</button>
|
||||||
<button className="option">Delete</button>
|
<button
|
||||||
|
className="option"
|
||||||
|
onClick={() => {
|
||||||
|
handleDeleteAction();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Delete
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -17,14 +17,15 @@ const ThreadChat: React.FC = () => {
|
||||||
{
|
{
|
||||||
replyId: "user 1",
|
replyId: "user 1",
|
||||||
creatorId: "1",
|
creatorId: "1",
|
||||||
createdAt: "hello, thread check",
|
createdAt: "2 hrs ago",
|
||||||
lastUpdatedAt: "2 hrs ago",
|
lastUpdatedAt: "2 hrs ago",
|
||||||
reply: "reply 1",
|
reply:
|
||||||
|
"reply testing reply content 1, reply testing reply content 1reply testing reply content 1",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
replyId: "user 2",
|
replyId: "user 2",
|
||||||
creatorId: "2",
|
creatorId: "2",
|
||||||
createdAt: "hello, thread check",
|
createdAt: "2 hrs ago",
|
||||||
lastUpdatedAt: "2 hrs ago",
|
lastUpdatedAt: "2 hrs ago",
|
||||||
reply: "reply 2",
|
reply: "reply 2",
|
||||||
},
|
},
|
||||||
|
|
|
@ -121,12 +121,14 @@
|
||||||
padding: 8px 4px;
|
padding: 8px 4px;
|
||||||
border-radius: #{$border-radius-medium};
|
border-radius: #{$border-radius-medium};
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(10px);
|
||||||
|
z-index: 100;
|
||||||
.options {
|
.options {
|
||||||
text-wrap: nowrap;
|
text-wrap: nowrap;
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
border-radius: #{$border-radius-medium};
|
border-radius: #{$border-radius-medium};
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
&:hover {
|
&:hover {
|
||||||
|
color: var(--text-button-color);
|
||||||
background: var(--background-color-accent);
|
background: var(--background-color-accent);
|
||||||
}
|
}
|
||||||
&.delete {
|
&.delete {
|
||||||
|
@ -159,6 +161,12 @@
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
.edit-container {
|
.edit-container {
|
||||||
.input-container {
|
.input-container {
|
||||||
|
textarea{
|
||||||
|
background: var(--background-color);
|
||||||
|
&:focus{
|
||||||
|
outline-color: var(--border-color-accent);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.actions-container {
|
.actions-container {
|
||||||
@include flex-space-between;
|
@include flex-space-between;
|
||||||
|
@ -169,34 +177,88 @@
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
.cancel-button,
|
.cancel-button,
|
||||||
.save-button {
|
.save-button {
|
||||||
padding: 4px 6px;
|
padding: 4px 10px;
|
||||||
border-radius: #{$border-radius-large};
|
border-radius: #{$border-radius-large};
|
||||||
background: var(--background-color-solid);
|
background: var(--background-color-solid);
|
||||||
outline: 1px solid var(--border-color);
|
outline: 1px solid var(--border-color);
|
||||||
}
|
}
|
||||||
.save-button {
|
.save-button {
|
||||||
|
color: var(--text-button-color);
|
||||||
|
background: var(--background-color-accent);
|
||||||
|
outline: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.message-container {
|
.message-container {
|
||||||
|
position: relative;
|
||||||
|
@include flex-space-between;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 12px;
|
||||||
|
margin-top: 8px;
|
||||||
|
&:first-child{
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
.profile {
|
.profile {
|
||||||
|
height: 28px;
|
||||||
|
width: 28px;
|
||||||
|
min-width: 28px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
line-height: 28px;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: #{$border-radius-circle};
|
||||||
}
|
}
|
||||||
.content {
|
.content {
|
||||||
|
width: 100%;
|
||||||
.user-details {
|
.user-details {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
gap: 8px;
|
||||||
.user-name {
|
.user-name {
|
||||||
|
text-transform: capitalize;
|
||||||
}
|
}
|
||||||
.time {
|
.time {
|
||||||
|
font-size: var(--font-size-tiny);
|
||||||
|
color: var(--input-text-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.more-options {
|
.more-options {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
.more-options-button {
|
.more-options-button {
|
||||||
}
|
@include flex-center;
|
||||||
.options-list {
|
height: 18px;
|
||||||
.option {
|
width: 18px;
|
||||||
|
border-radius: #{$border-radius-small};
|
||||||
|
&:hover{
|
||||||
|
background: var(--background-color-solid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.options-list {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
padding: 3px 6px;
|
||||||
|
background: var(--background-color);
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
outline: 1px solid var(--border-color);
|
||||||
|
border-radius: #{$border-radius-medium};
|
||||||
|
z-index: 100;
|
||||||
|
.option {
|
||||||
|
width: 100%;
|
||||||
|
border-radius: #{$border-radius-medium};
|
||||||
|
padding: 2px 6px;
|
||||||
|
text-align: start;
|
||||||
|
&:hover{
|
||||||
|
background: var(--background-color-accent);
|
||||||
|
color: var(--text-button-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.message{
|
||||||
|
margin-top: 6px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue