1use gpui2::elements::div;
2use gpui2::style::StyleHelpers;
3use gpui2::{Element, IntoElement, ViewContext};
4
5use crate::theme;
6
7#[derive(Element)]
8pub struct Indicator {
9 player: usize,
10}
11
12pub fn indicator() -> Indicator {
13 Indicator { player: 0 }
14}
15
16impl Indicator {
17 pub fn player(mut self, player: usize) -> Self {
18 self.player = player;
19 self
20 }
21
22 fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
23 let theme = theme(cx);
24 let player_color = theme.players[self.player].cursor;
25
26 div()
27 .w_4()
28 .h_1()
29 .rounded_bl_sm()
30 .rounded_br_sm()
31 .fill(player_color)
32 }
33}