Skip to content

Commit

Permalink
feat: Auto translation for Angular SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
szuperaz committed Sep 16, 2022
1 parent 4f0676d commit 873f7c4
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/v1/Message.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@
*/
.str-chat__message-inner {
min-width: 0;

.str-chat__translation-notice {
button {
cursor: pointer;
padding: 0.25rem 0;
margin: 0;
font-size: 14px;
line-height: 16px;
color: var(--lighten-grey);
border: none;
background: none;

&:active,
&:hover {
background: var(--grey-whisper);
}
}
}
}

.quoted-message {
Expand Down
12 changes: 12 additions & 0 deletions src/v2/styles/Message/Message-layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
grid-template-areas:
'avatar message'
'. replies'
'. translation-notice'
'. metadata';
column-gap: var(--str-chat__spacing-2);
grid-template-columns: auto 1fr;
Expand All @@ -81,6 +82,7 @@
grid-template-areas:
'message'
'replies'
'translation-notice'
'metadata';
justify-items: end;

Expand Down Expand Up @@ -166,6 +168,16 @@
}
}

.str-chat__translation-notice {
grid-area: translation-notice;

button {
cursor: pointer;
padding: var(--str-chat__spacing-1) 0;
margin: 0;
}
}

.str-chat__message-metadata {
grid-area: metadata;
display: flex;
Expand Down
20 changes: 20 additions & 0 deletions src/v2/styles/Message/Message-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@

/* Box shadow applied to a date separator */
--str-chat__date-separator-box-shadow: none;

/* The text color of the translation notice that is displayed if a message is translated with auto-translation */
--str-chat__translation-notice-color: var(--str-chat__text-low-emphasis-color);

/* The hover color of the translation notice that is displayed if a message is translated with auto-translation */
--str-chat__translation-notice-active-background-color: var(--str-chat__tertiary-surface-color);
}

.str-chat__message--system {
Expand Down Expand Up @@ -237,6 +243,20 @@
}
}

.str-chat__translation-notice {
button {
font: var(--str-chat__body2-text);
color: var(--str-chat__translation-notice-color);
border: none;
background: none;

&:active,
&:hover {
background: var(--str-chat__translation-notice-active-background-color);
}
}
}

.str-chat__message-metadata {
color: var(--str-chat__message-secondary-color);
font: var(--str-chat__caption-text);
Expand Down

0 comments on commit 873f7c4

Please sign in to comment.