dev-protocol / dev-elements

Web Components for Dev Protocol
MIT License
7 stars 1 forks source link

[FEATURE] <dev-stake-on> #119

Open aggre opened 2 years ago

aggre commented 2 years ago

Detailed description

This issue doesn't have a more in-depth spec, it just suggests a feature.


By declaring HTML as follows, the button which is the default slot element is displayed. Clicking that button will bring up a modal dialog with tier slots as child elements and start the staking flow.

<dev-stake-on connection="CONNECTION_ID" destination="0x..." network="NETWORK_NAME">
    <section slot="tier" amount="100">This is the 1st tier</section>
    <section slot="tier" amount="200">This is the 2nd tier</section>
    <section slot="tier" amount="300">This is the 3rd tier</section>
    <button>Please stake on me</button>
</dev-stake-on>

Options

Context

You can easily build such paywalls by using this combined with <dev-when-staked> #118 .

Screenshot 2022-04-14 at 10-04-40 20220406

Possible implementation

No response

Additional information

No response

Code of Conduct

MatteuSan commented 2 years ago

I feel like we can use the currently in the works hashi dialog, but the design would change a bit. As for the styling, I don't think we can use the hashi lib directly since shadow DOM works in a different way than regular DOM and virtual DOM. So styling is going to be a special implementation for a start.

Also for the buttons, we can use the hashi-lit button, but that's still in development so I don't really know about that.

aggre commented 2 years ago

The design does not have to be as per this attached image, we are free to think as we please. By the way, wouldn't it be cool if we could build it with just lit (i.e. just lit-html) instead of LitElement?

aggre commented 2 years ago

I'm thinking about what kind of implementation can be done to use Hashi in Shadow DOM. In essence, the child elements of top-level Custom Elements don't have to be Shadow DOM. Therefore, if the top-level Custom Elements have Hashi and Tailwind class declarations in the Shadow DOM, we can use them in child elements.

Also, with ullr, we can use Shadow DOM inline without class definition, and there is also an API for declaring Custom Elements. using LitElement just for Shadow DOM and Custom Elements may be a bit of an exaggeration.

https://github.com/dev-protocol/dev-elements/blob/2fa74c8021c5d7e4d15fa23334715b251b8263ca/src/stake-on-me-button/index.ts#L5-L12

https://github.com/dev-protocol/dev-elements/blob/2fa74c8021c5d7e4d15fa23334715b251b8263ca/src/stake-on-me-button/element.ts#L4-L10

aggre commented 2 years ago

@MatteuSan I've changed to using the Tailwind classes in Shadow DOM in #129, so I ping you!

MatteuSan commented 2 years ago

@MatteuSan I've changed to using the Tailwind classes in Shadow DOM in #129, so I ping you! aight gotcha