forked from alemi/upub
feat(web): improved Document object view
doesn't work retroactively but new lemmy posts should look more like lemmy posts
This commit is contained in:
parent
1bd93d7c2b
commit
09325c91de
2 changed files with 33 additions and 19 deletions
|
@ -203,6 +203,16 @@
|
||||||
min-width: 2em;
|
min-width: 2em;
|
||||||
max-width: 2em;
|
max-width: 2em;
|
||||||
}
|
}
|
||||||
|
div.flex-pic-container {
|
||||||
|
flex: 1;
|
||||||
|
border: solid 3px #bf616a;
|
||||||
|
margin-right: .5em;
|
||||||
|
}
|
||||||
|
div.flex-pic {
|
||||||
|
background-size: cover;
|
||||||
|
margin: 5px;
|
||||||
|
height: calc(100% - 10px); /* TODO can we avoid this calc() without having this overflow??? */
|
||||||
|
}
|
||||||
.box {
|
.box {
|
||||||
border: 3px solid var(--accent);
|
border: 3px solid var(--accent);
|
||||||
}
|
}
|
||||||
|
@ -215,7 +225,6 @@
|
||||||
img.attachment {
|
img.attachment {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
height: 10em;
|
height: 10em;
|
||||||
width: 100%;
|
|
||||||
border: 3px solid var(--accent);
|
border: 3px solid var(--accent);
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
|
|
|
@ -38,7 +38,7 @@ pub fn Attachment(
|
||||||
view! {
|
view! {
|
||||||
<p class="center">
|
<p class="center">
|
||||||
<img
|
<img
|
||||||
class="attachment"
|
class="w-100 attachment"
|
||||||
class:expand=expand
|
class:expand=expand
|
||||||
src={move || if sensitive && !expand.get() {
|
src={move || if sensitive && !expand.get() {
|
||||||
URL_SENSITIVE.to_string()
|
URL_SENSITIVE.to_string()
|
||||||
|
@ -78,18 +78,11 @@ pub fn Attachment(
|
||||||
|
|
||||||
"link" =>
|
"link" =>
|
||||||
view! {
|
view! {
|
||||||
<ul> // TODO kind of wasteful to make 1-item list, can we just add the same style to a div?
|
<p class="center mt-s mb-s">
|
||||||
<li>
|
<a href={href.clone()} title={href.clone()} rel="noreferrer nofollow" target="_blank">
|
||||||
<a href={href.clone()} title={href.clone()} rel="noreferrer nofollow" target="_blank">
|
<input type="submit" class="w-100" value={Uri::pretty(&href)} title={object.name().unwrap_or_default().to_string()} />
|
||||||
{Uri::pretty(&href)}
|
</a>
|
||||||
</a>
|
</p>
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{object.name().map(|name| {
|
|
||||||
view! {
|
|
||||||
<p class="center mt-0"><small>{name.to_string()}</small></p>
|
|
||||||
}
|
|
||||||
})}
|
|
||||||
}.into_view(),
|
}.into_view(),
|
||||||
|
|
||||||
_ =>
|
_ =>
|
||||||
|
@ -149,6 +142,15 @@ pub fn Object(object: crate::Object) -> impl IntoView {
|
||||||
</a>
|
</a>
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let post_image = object.image().get().and_then(|x| x.url().id().str()).map(|x| view! {
|
||||||
|
<div class="flex-pic-container">
|
||||||
|
<a href={x.clone()} target="_blank">
|
||||||
|
<div class="flex-pic" style={format!("background-image: url('{x}')")}>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
});
|
||||||
|
|
||||||
let post_inner = view! {
|
let post_inner = view! {
|
||||||
<Summary summary=object.summary().ok().map(|x| x.to_string()) >
|
<Summary summary=object.summary().ok().map(|x| x.to_string()) >
|
||||||
<p inner_html={content}></p>
|
<p inner_html={content}></p>
|
||||||
|
@ -163,11 +165,14 @@ pub fn Object(object: crate::Object) -> impl IntoView {
|
||||||
}.into_view(),
|
}.into_view(),
|
||||||
// lemmy with Page, peertube with Video
|
// lemmy with Page, peertube with Video
|
||||||
Ok(apb::ObjectType::Document(t)) => view! {
|
Ok(apb::ObjectType::Document(t)) => view! {
|
||||||
<article class="ml-1 mr-1">
|
<article class="ml-1 mr-1" style="display: flex">
|
||||||
<h4 class="mt-s mb-1" title={t.as_ref().to_string()}>
|
{post_image}
|
||||||
<b>{object.name().unwrap_or_default().to_string()}</b>
|
<div style="flex: 3">
|
||||||
</h4>
|
<h4 class="mt-s mb-1" title={t.as_ref().to_string()}>
|
||||||
{post_inner}
|
<b>{object.name().unwrap_or_default().to_string()}</b>
|
||||||
|
</h4>
|
||||||
|
{post_inner}
|
||||||
|
</div>
|
||||||
</article>
|
</article>
|
||||||
}.into_view(),
|
}.into_view(),
|
||||||
// wordpress, ... ?
|
// wordpress, ... ?
|
||||||
|
|
Loading…
Reference in a new issue