Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Added <avatar> object #196

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from
Open

Conversation

JanluOfficial
Copy link

@JanluOfficial JanluOfficial commented Jun 16, 2024

grafik
(Ignore the first five commits)

Let me introduce the newest technology in webx: Avatars!

Utilizing the libadwaita avatar object, you can now add avatars directly to your webpage using the tag. Here's how it works.

<avatar size="caseoh" text="Case Oh" src="path/to/caseoh.png"/>

Size

This attribute controls the size of the avatar object. There are a select few pre-set sizes.

  • xs = 16
  • s = 32
  • m = 48 (default)
  • l = 64
  • xl = 96
  • caseoh = 1024

Additionally, if a number is entered, the size will be set to that. If not defined, it will default to 48.

Text

This attribute is used to show initials on the avatar. This is only really useful if you don't apply an image to the avatar. If not defined, an avatar icon will be shown.

Src

This attribute defines the image set in the avatar. If not defined, the default icon/initials will be used. If the image is unable to load, the avatar will simply turn invisible, which is not intentional but I'm too lazy to fix it.

@JanluOfficial
Copy link
Author

JanluOfficial commented Jun 16, 2024

I don't know why there's 25 removed lines, I don't remember doing that. They didn't impact me during testing though.

@inventionpro
Copy link

This is very cool, is there a way for the avatars to not be a perfect circle? maybe like a rounded square or just a square

Comment on lines 69 to 70
"Couldn't find head. Invalid HTML?".to_owned(),
"Couetch_imageldn't find head. Invalid HTML?".to_owned(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened to this ?

Copy link
Author

@JanluOfficial JanluOfficial Jun 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidentally triggered a paste here, idk. Will fix.
I gotta disable middle click to paste.

@JanluOfficial
Copy link
Author

This is very cool, is there a way for the avatars to not be a perfect circle? maybe like a rounded square or just a square

@inventionpro unfortunately not currently. Since I'm using libadwaitas built in Avatar Object, it's limited to a circle. Maybe in the future, I can try to rework it to use a regular image, so it can be a rounded square.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants