gpui: Add SharedUrl type (#3975)

This PR adds a `SharedUrl` type to GPUI.

It's just like a `SharedString`, but for denoting that the contained
value is a URL.

Mainlined from @nathansobo's GPUI blog post:
https://github.com/zed-industries/zed/pull/3968/files#diff-7ee75937e2daf7dd53f71b17698d8bd6d46993d06928d411781b9bd739b5f231R9-R12

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-01-09 10:55:49 -05:00 committed by GitHub
parent fa53353c57
commit f0ef63bfa0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 48 additions and 21 deletions

View file

@ -1,10 +1,10 @@
use gpui::{img, prelude::*, AnyElement};
use gpui::{img, prelude::*, AnyElement, SharedUrl};
use smallvec::SmallVec;
use ui::prelude::*;
#[derive(IntoElement)]
pub struct CollabNotification {
avatar_uri: SharedString,
avatar_uri: SharedUrl,
accept_button: Button,
dismiss_button: Button,
children: SmallVec<[AnyElement; 2]>,
@ -12,7 +12,7 @@ pub struct CollabNotification {
impl CollabNotification {
pub fn new(
avatar_uri: impl Into<SharedString>,
avatar_uri: impl Into<SharedUrl>,
accept_button: Button,
dismiss_button: Button,
) -> Self {