diff --git a/README.md b/README.md index 6e202ff..e778d04 100644 --- a/README.md +++ b/README.md @@ -20,60 +20,33 @@ ``` Rust -use iced::{Sandbox, Settings, Theme}; -use iced_aw::BOOTSTRAP_FONT_BYTES; +use iced::{Settings, Task, Theme}; +use icy_browser::{get_fonts, BasicBrowser, Bookmark, Message}; -use icy_browser::{widgets, BrowserWidget, Ultralight}; +fn run() -> (BasicBrowser, Task) { + ( + BasicBrowser::new_basic() + .with_tab_bar() + .with_nav_bar() + .with_bookmark_bar(vec![Bookmark::new( + "https://www.rust-lang.org", + "rust-lang.org", + )]) + .build(), + Task::none(), + ) +} -fn main() -> Result<(), iced::Error> { - // This imports `icons` for widgets - let bootstrap_font = BOOTSTRAP_FONT_BYTES.into(); +fn main() -> iced::Result { let settings = Settings { - fonts: vec![bootstrap_font], + fonts: get_fonts(), ..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) - } -}``` +```