Skip to content

Commit

Permalink
update readme with picture of basic_browser
Browse files Browse the repository at this point in the history
fix url and code block

fix basic_brower catagory
  • Loading branch information
LegitCamper committed Aug 19, 2024
1 parent 7736f70 commit 97c39b9
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 2 deletions.
78 changes: 76 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,79 @@
## Iced library to create custom browsers

[![Build](https://github.com/LegitCamper/rust-browser/actions/workflows/ci.yml/badge.svg)](https://github.com/LegitCamper/rust-browser/actions/workflows/ci.yml)
<img src="https://raw.githubusercontent.com/gist/hecrj/ad7ecd38f6e47ff3688a38c79fd108f0/raw/74384875ecbad02ae2a926425e9bcafd0695bade/color.svg" width=8%>

<img src="https://raw.githubusercontent.com/gist/hecrj/ad7ecd38f6e47ff3688a38c79fd108f0/raw/74384875ecbad02ae2a926425e9bcafd0695bade/color.svg" width=20% height=20%>
### Supported Browser Engines
| Browser Engine | Support |
| ----------------- | --------- |
| WebKit/Ultralight | <span>&#10003;</span> |
| Chromium/CEF | X Planned |

## Iced library to create custom browsers

### Browser Widgets
- Navigation Bar
- Tab Bar
- Browser View

### Examples
#### basic_browser.rs
![](https://github.com/LegitCamper/rust-browser/blob/main/assets/basic_browser.png)
``` Rust
use iced::{Sandbox, Settings, Theme};
use iced_aw::BOOTSTRAP_FONT_BYTES;

use icy_browser::{widgets, BrowserWidget, Ultralight};

fn main() -> Result<(), iced::Error> {
// This imports `icons` for widgets
let bootstrap_font = BOOTSTRAP_FONT_BYTES.into();
let settings = Settings {
fonts: vec![bootstrap_font],
..Default::default()
};
Browser::run(settings)
}

struct Browser {
widgets: BrowserWidget<Ultralight>,
}

#[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)
}
}
```
Binary file added assets/basic_browser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 97c39b9

Please sign in to comment.