Fix placeholder style for Input (#32)
https://github.com/huacnlee/gpui-component/issues/27
This commit is contained in:
parent
35cec4cf5c
commit
4ca98029dd
3 changed files with 22 additions and 37 deletions
41
README.md
41
README.md
|
|
@ -1,28 +1,11 @@
|
|||
# GPUI Compoment
|
||||
|
||||
A UI component library for building desktop application by using GPUI.
|
||||
> This is still an early stage of development, we may change API frequently.
|
||||
> But the features is ok to use, you must keep tracking our changes.
|
||||
|
||||
The goal of this project is to provide a set of UI components for building desktop applications, and it is based on [GPUI](https://gpui.rs).
|
||||
A UI components for building desktop application by using [GPUI](https://gpui.rs).
|
||||
|
||||
## Showcase
|
||||
|
||||
This is an example of build app by using GPUI.
|
||||
|
||||
<https://github.com/huacnlee/gpui-app/assets/5518/ad103f02-697a-40ed-a876-8b13e4242a72>
|
||||
|
||||
<https://github.com/huacnlee/gpui-app/assets/5518/5316f9f0-58c8-4b99-bd79-eafffb38c3fc>
|
||||
|
||||
<https://github.com/huacnlee/gpui-app/assets/5518/0273e031-4426-4ab5-a41c-f7cbbb0e55bc>
|
||||
|
||||
<https://github.com/huacnlee/gpui-component/assets/5518/51622a5e-f51d-4ede-8cae-04cae703f8aa>
|
||||
|
||||
## Demo
|
||||
|
||||
- [main-app-windows.zip](https://github.com/user-attachments/files/16195804/main-app.zip) - Updated at 2024/07/12
|
||||
- [main-app-windows.zip](https://github.com/user-attachments/files/16049565/main-app.zip) - Updated at 2024/07/01
|
||||
- [main-app-windows.zip](https://github.com/user-attachments/files/16039599/main-app.zip) - Updated at 2024/06/29
|
||||
|
||||
## TODO
|
||||
## Features
|
||||
|
||||
- [x] Theming
|
||||
- [ ] TextField
|
||||
|
|
@ -81,6 +64,22 @@ This is an example of build app by using GPUI.
|
|||
- [ ] Drawer
|
||||
- [ ] Modal
|
||||
|
||||
## Showcase
|
||||
|
||||
<https://github.com/huacnlee/gpui-app/assets/5518/ad103f02-697a-40ed-a876-8b13e4242a72>
|
||||
|
||||
<https://github.com/huacnlee/gpui-app/assets/5518/5316f9f0-58c8-4b99-bd79-eafffb38c3fc>
|
||||
|
||||
<https://github.com/huacnlee/gpui-app/assets/5518/0273e031-4426-4ab5-a41c-f7cbbb0e55bc>
|
||||
|
||||
<https://github.com/huacnlee/gpui-component/assets/5518/51622a5e-f51d-4ede-8cae-04cae703f8aa>
|
||||
|
||||
## Demo
|
||||
|
||||
- [main-app-windows.zip](https://github.com/user-attachments/files/16195804/main-app.zip) - Updated at 2024/07/12
|
||||
- [main-app-windows.zip](https://github.com/user-attachments/files/16049565/main-app.zip) - Updated at 2024/07/01
|
||||
- [main-app-windows.zip](https://github.com/user-attachments/files/16039599/main-app.zip) - Updated at 2024/06/29
|
||||
|
||||
## How to build
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -64,11 +64,7 @@ impl InputStory {
|
|||
|
||||
Self {
|
||||
input1,
|
||||
input2: cx.new_view(|cx| {
|
||||
let mut input = TextInput::new(cx);
|
||||
input.set_placeholder("Enter text here...", cx);
|
||||
input
|
||||
}),
|
||||
input2: cx.new_view(|cx| TextInput::new(cx).placeholder("Enter text here...")),
|
||||
mash_input: mask_input,
|
||||
disabled_input: cx.new_view(|cx| {
|
||||
let mut input = TextInput::new(cx);
|
||||
|
|
|
|||
|
|
@ -150,16 +150,6 @@ impl TextInput {
|
|||
cx.notify();
|
||||
}
|
||||
|
||||
/// Set the placeholder text of the input field.
|
||||
pub fn set_placeholder(
|
||||
&mut self,
|
||||
placeholder: impl Into<SharedString>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) {
|
||||
self.placeholder = placeholder.into();
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
/// Set the disabled state of the input field.
|
||||
pub fn set_disabled(&mut self, disabled: bool, cx: &mut ViewContext<Self>) {
|
||||
self.disabled = disabled;
|
||||
|
|
@ -601,7 +591,7 @@ impl Element for TextElement {
|
|||
};
|
||||
|
||||
let run = TextRun {
|
||||
len: input.text.len(),
|
||||
len: disaplay_text.len(),
|
||||
font: style.font(),
|
||||
color: text_color,
|
||||
background_color: None,
|
||||
|
|
|
|||
Loading…
Reference in a new issue