-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(crypto-helper): asn1: implement node options PoC
- Loading branch information
1 parent
beb1b15
commit cb00d0f
Showing
8 changed files
with
98 additions
and
19 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
mod asn1_viewer; | ||
mod hex_view; | ||
mod node_options; | ||
mod scheme; | ||
|
||
use std::rc::Rc; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use yew::{function_component, html, use_state, Callback, Html, Properties}; | ||
|
||
#[derive(PartialEq, Properties, Clone)] | ||
pub struct NodeOptionsProps { | ||
pub offset: usize, | ||
pub length_len: usize, | ||
pub data_len: usize, | ||
} | ||
|
||
#[function_component(NodeOptions)] | ||
pub fn node_options(props: &NodeOptionsProps) -> Html { | ||
let show_options = use_state(|| false); | ||
|
||
let flag = *show_options; | ||
let show_options_setter = show_options.setter(); | ||
|
||
let onclick = Callback::from(move |_| { | ||
show_options_setter.set(!flag); | ||
}); | ||
|
||
html! { | ||
<div class="asn1-node-options-container"> | ||
{if *show_options {html! { | ||
<div style="position: relative"> | ||
<div class="asn1-node-options"> | ||
<span>{format!("Offset: {}", props.offset)}</span> | ||
<span>{format!("Length: {}+{}", props.length_len, props.data_len)}</span> | ||
</div> | ||
</div> | ||
}} else {html! {}}} | ||
<button class="asn1-button-with-icon" {onclick}> | ||
<img src="/public/img/icons/more_vertical.png" /> | ||
</button> | ||
</div> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters