mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 13:14:58 +08:00
Improve LinkPreviewWidget (#8881)
* Use shorthand for margin values Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Merge style declarations Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Merge style declarations Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Include mx_MatrixChat_useCompactLayout in mx_LinkPreviewWidget Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Include in mx_LinkPreviewWidget Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * yarn run lint:style --fix Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Use spacing variables Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Use logical variables Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Prevent flex children blowout Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Wrap caption Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * yarn run lint:style --fix Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Set row-gap between image and caption Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Set column-gap between the caption and close button Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Rename the class name Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Decrease inline spacing Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
This commit is contained in:
parent
37d8cfbc50
commit
0909bfeb38
@ -15,53 +15,62 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
.mx_LinkPreviewWidget {
|
.mx_LinkPreviewWidget {
|
||||||
margin-top: 15px;
|
margin: $spacing-16 0 $spacing-16 auto;
|
||||||
margin-right: 15px;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
border-left: 2px solid $preview-widget-bar-color;
|
column-gap: $spacing-4;
|
||||||
|
border-inline-start: 2px solid $preview-widget-bar-color;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
color: $info-plinth-fg-color;
|
color: $info-plinth-fg-color;
|
||||||
}
|
|
||||||
|
|
||||||
.mx_LinkPreviewWidget_image {
|
.mx_MatrixChat_useCompactLayout & {
|
||||||
|
margin-top: 6px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exclude mx_LinkPreviewGroup_hide from wrapping
|
||||||
|
.mx_LinkPreviewWidget_wrapImageCaption {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
row-gap: $spacing-8;
|
||||||
|
|
||||||
|
.mx_LinkPreviewWidget_image,
|
||||||
|
.mx_LinkPreviewWidget_caption {
|
||||||
|
margin-inline-start: $spacing-16;
|
||||||
|
min-width: 0; // Prevent blowout
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_LinkPreviewWidget_image {
|
||||||
flex: 0 0 100px;
|
flex: 0 0 100px;
|
||||||
margin-left: 15px;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_LinkPreviewWidget_caption {
|
.mx_LinkPreviewWidget_caption {
|
||||||
margin-left: 15px;
|
flex: 1;
|
||||||
flex: 1 1 auto;
|
|
||||||
overflow: hidden; // cause it to wrap rather than clip
|
overflow: hidden; // cause it to wrap rather than clip
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_LinkPreviewWidget_title {
|
.mx_LinkPreviewWidget_title,
|
||||||
font-weight: bold;
|
.mx_LinkPreviewWidget_description {
|
||||||
white-space: normal;
|
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-line-clamp: 2;
|
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_LinkPreviewWidget_title {
|
||||||
|
font-weight: bold;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
|
||||||
.mx_LinkPreviewWidget_siteName {
|
.mx_LinkPreviewWidget_siteName {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_LinkPreviewWidget_description {
|
.mx_LinkPreviewWidget_description {
|
||||||
margin-top: 8px;
|
margin-top: $spacing-8;
|
||||||
white-space: normal;
|
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-line-clamp: 3;
|
-webkit-line-clamp: 3;
|
||||||
-webkit-box-orient: vertical;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.mx_MatrixChat_useCompactLayout {
|
|
||||||
.mx_LinkPreviewWidget {
|
|
||||||
margin-top: 6px;
|
|
||||||
margin-bottom: 6px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,7 @@ export default class LinkPreviewWidget extends React.Component<IProps> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx_LinkPreviewWidget">
|
<div className="mx_LinkPreviewWidget">
|
||||||
|
<div className="mx_LinkPreviewWidget_wrapImageCaption">
|
||||||
{ img }
|
{ img }
|
||||||
<div className="mx_LinkPreviewWidget_caption">
|
<div className="mx_LinkPreviewWidget_caption">
|
||||||
<div className="mx_LinkPreviewWidget_title">
|
<div className="mx_LinkPreviewWidget_title">
|
||||||
@ -132,6 +133,7 @@ export default class LinkPreviewWidget extends React.Component<IProps> {
|
|||||||
{ description }
|
{ description }
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{ this.props.children }
|
{ this.props.children }
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user