migrate ui components to gpui-kit
This commit is contained in:
@@ -4,20 +4,20 @@ use gpui::{
|
||||
App, AppContext, Context, Entity, IntoElement, ParentElement, Render, SharedString, Styled,
|
||||
Subscription, Task, Window, div, px, relative,
|
||||
};
|
||||
use gpui_kit::component::button::{Button, ButtonVariants};
|
||||
use gpui_kit::component::input::{Input, InputEvent, InputState};
|
||||
use gpui_kit::component::{ActiveTheme, Disableable, WindowExt, v_flex};
|
||||
use instant::Duration;
|
||||
use nostr_connect::prelude::*;
|
||||
use state::NostrRegistry;
|
||||
use theme::{ActiveTheme, TextStyle, Typeset as _, surface_radius};
|
||||
use ui::button::{Button, ButtonVariants};
|
||||
use ui::input::{Input, InputEvent, InputState};
|
||||
use ui::{Disableable, WindowExtension, v_flex};
|
||||
use ui::{TextStyle, Typeset as _, surface_radius};
|
||||
|
||||
pub fn open(window: &mut Window, cx: &mut App) {
|
||||
let import = cx.new(|cx| ImportIdentity::new(window, cx));
|
||||
|
||||
window.open_dialog(cx, move |this, _window, _cx| {
|
||||
this.width(px(450.))
|
||||
.show_close(false)
|
||||
.close_button(false)
|
||||
.overlay_closable(false)
|
||||
.keyboard(false)
|
||||
.title("Continue with your Nostr Identity")
|
||||
@@ -31,7 +31,7 @@ pub fn open_unlock(window: &mut Window, cx: &mut App) {
|
||||
|
||||
window.open_dialog(cx, move |this, _window, _cx| {
|
||||
this.width(px(450.))
|
||||
.show_close(false)
|
||||
.close_button(false)
|
||||
.overlay_closable(false)
|
||||
.keyboard(false)
|
||||
.title("Unlock your identity")
|
||||
@@ -242,12 +242,12 @@ impl Render for ImportIdentity {
|
||||
.text_style(TextStyle::Callout)
|
||||
.child(
|
||||
v_flex()
|
||||
.gap(px(theme::SPACE))
|
||||
.gap(px(ui::SPACE))
|
||||
.when(!is_unlock, |this| {
|
||||
this.child(
|
||||
v_flex()
|
||||
.gap_1()
|
||||
.text_color(cx.theme().text_muted)
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.child("Use secret key or bunker connection")
|
||||
.child(Input::new(&self.key_input)),
|
||||
)
|
||||
@@ -256,7 +256,7 @@ impl Render for ImportIdentity {
|
||||
this.child(
|
||||
v_flex()
|
||||
.gap_1()
|
||||
.text_color(cx.theme().text_muted)
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.child(if is_unlock {
|
||||
"Passphrase to unlock your identity:"
|
||||
} else {
|
||||
@@ -269,14 +269,14 @@ impl Render for ImportIdentity {
|
||||
this.child(
|
||||
v_flex()
|
||||
.gap_1()
|
||||
.text_color(cx.theme().text_muted)
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.child("Passphrase to encrypt your key on this device:")
|
||||
.child(Input::new(&self.pass_input)),
|
||||
)
|
||||
.child(
|
||||
v_flex()
|
||||
.gap_1()
|
||||
.text_color(cx.theme().text_muted)
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.child("Repeat Passphrase:")
|
||||
.child(Input::new(&self.repass_input)),
|
||||
)
|
||||
@@ -286,7 +286,7 @@ impl Render for ImportIdentity {
|
||||
div()
|
||||
.p_2()
|
||||
.rounded(px(surface_radius()))
|
||||
.bg(cx.theme().warning_muted)
|
||||
.bg(cx.theme().warning.opacity(0.15))
|
||||
.text_style(TextStyle::Caption)
|
||||
.text_color(cx.theme().warning)
|
||||
.line_height(relative(1.2))
|
||||
@@ -298,7 +298,7 @@ impl Render for ImportIdentity {
|
||||
div()
|
||||
.p_2()
|
||||
.rounded(px(surface_radius()))
|
||||
.bg(cx.theme().warning_muted)
|
||||
.bg(cx.theme().warning.opacity(0.15))
|
||||
.text_style(TextStyle::Caption)
|
||||
.text_color(cx.theme().warning)
|
||||
.line_height(relative(1.2))
|
||||
|
||||
Reference in New Issue
Block a user