Skip to content

Commit

Permalink
Use consistent 4 spacing between messages & top / bottom
Browse files Browse the repository at this point in the history
We only had 4 spacing between messages & text input.
When topic is showing, we should only have 4 spacing
between it and messages.

Previously it was 8 + 3 which added way too much spacing
and looked a bit off compared to messages / input.
  • Loading branch information
tarkah committed Mar 13, 2024
1 parent bfa1965 commit dd017fc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 28 deletions.
47 changes: 20 additions & 27 deletions src/buffer/channel.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use data::server::Server;
use data::User;
use data::{channel, client, history, message, Config};
use iced::widget::{column, container, row, vertical_space};
use iced::widget::{column, container, row};
use iced::{Command, Length};

use super::{input_view, scroll_view, user_context};
Expand Down Expand Up @@ -125,22 +125,18 @@ pub fn view<'a>(
let topic = topic(state, clients, users, settings, config).unwrap_or_else(|| column![].into());

let text_input = show_text_input.then(|| {
column![
vertical_space(4),
input_view::view(
&state.input_view,
buffer,
users,
channels,
input_history,
is_focused
)
.map(Message::InputView)
]
.width(Length::Fill)
input_view::view(
&state.input_view,
buffer,
users,
channels,
input_history,
is_focused,
)
.map(Message::InputView)
});

let content = column![].push(topic).push(messages);
let content = column![topic, messages].spacing(4);

let content = match (settings.users.visible, config.buffer.channel.users.position) {
(true, data::channel::Position::Left) => {
Expand All @@ -155,6 +151,7 @@ pub fn view<'a>(
let body = column![]
.push(container(content).height(Length::Fill))
.push_maybe(text_input)
.spacing(4)
.height(Length::Fill);

container(body)
Expand Down Expand Up @@ -249,19 +246,15 @@ fn topic<'a>(
let topic = clients.get_channel_topic(&state.server, &state.channel)?;

Some(
container(
topic::view(
topic.text.as_deref()?,
topic.who.as_deref(),
topic.time.as_ref(),
config.buffer.channel.topic.max_lines,
users,
config,
)
.map(Message::UserContext),
topic::view(
topic.text.as_deref()?,
topic.who.as_deref(),
topic.time.as_ref(),
config.buffer.channel.topic.max_lines,
users,
config,
)
.padding([0, 0, 3, 0])
.into(),
.map(Message::UserContext),
)
}

Expand Down
5 changes: 4 additions & 1 deletion src/buffer/channel/topic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ pub fn view<'a>(
.padding(padding()),
column![container(scrollable)].width(Length::Fill),
),
container(horizontal_rule(1)).width(Length::Fill).padding([8, 11])
container(horizontal_rule(1))
.width(Length::Fill)
.padding([0, 11])
]
.spacing(8)
.into()
}

Expand Down

0 comments on commit dd017fc

Please sign in to comment.