diff --git a/README.md b/README.md
index 9cfb9dc..6e202ff 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,7 @@
## Iced library to create custom browsers
+
[![Build](https://github.com/LegitCamper/icy_browser/actions/workflows/ci.yml/badge.svg)](https://github.com/LegitCamper/icy_browser/actions/workflows/ci.yml)
-
-
-### Supported Platforms
-| Platform | Support |
-| Windows | ✓ |
-| Linux | ✓ |
-
### Supported Browser Engines
| Browser Engine | Support |
@@ -23,32 +17,63 @@
### Examples
#### basic_browser.rs
-
+
``` Rust
-use iced::{Settings, Task, Theme};
-use icy_browser::{get_fonts, BasicBrowser, Message};
+use iced::{Sandbox, Settings, Theme};
+use iced_aw::BOOTSTRAP_FONT_BYTES;
-fn run() -> (BasicBrowser, Task) {
- (
- BasicBrowser::new_basic()
- .with_tab_bar()
- .with_nav_bar()
- .build(),
- Task::none(),
- )
-}
+use icy_browser::{widgets, BrowserWidget, Ultralight};
-fn main() -> iced::Result {
+fn main() -> Result<(), iced::Error> {
+ // This imports `icons` for widgets
+ let bootstrap_font = BOOTSTRAP_FONT_BYTES.into();
let settings = Settings {
- fonts: get_fonts(),
+ fonts: vec![bootstrap_font],
..Default::default()
};
+ Browser::run(settings)
+}
+
+struct Browser {
+ widgets: BrowserWidget,
+}
- iced::application("Basic Browser", BasicBrowser::update, BasicBrowser::view)
- .subscription(BasicBrowser::subscription)
- .settings(settings)
- .theme(|_| Theme::Dark)
- .run_with(run)
+#[derive(Debug, Clone)]
+pub enum Message {
+ BrowserWidget(widgets::Message),
}
-```
+
+impl Sandbox for Browser {
+ type Message = Message;
+
+ fn new() -> Self {
+ let widgets = BrowserWidget::new_with_ultralight()
+ .with_tab_bar()
+ .with_nav_bar()
+ .with_browsesr_view()
+ .build();
+
+ Self { widgets }
+ }
+
+ fn title(&self) -> String {
+ String::from("Basic Browser")
+ }
+
+ fn theme(&self) -> Theme {
+ Theme::Dark
+ }
+
+ fn update(&mut self, message: Self::Message) {
+ match message {
+ Message::BrowserWidget(msg) => {
+ self.widgets.update(msg);
+ }
+ }
+ }
+
+ fn view(&self) -> iced::Element<'_, Self::Message> {
+ self.widgets.view().map(Message::BrowserWidget)
+ }
+}```