Group up existing components into elements
This commit is contained in:
2
elements/Avatar/Avatar.pixy
Normal file
2
elements/Avatar/Avatar.pixy
Normal file
@ -0,0 +1,2 @@
|
||||
component Avatar(user *arn.User)
|
||||
CustomAvatar(user, user.Link(), user.Nick)
|
5
elements/Avatar/AvatarNoLink.pixy
Normal file
5
elements/Avatar/AvatarNoLink.pixy
Normal file
@ -0,0 +1,5 @@
|
||||
component AvatarNoLink(user *arn.User)
|
||||
if user.HasAvatar()
|
||||
img.user-image.lazy(data-src=user.AvatarLink("small"), data-webp="true", alt=user.Nick)
|
||||
else
|
||||
SVGAvatar(user)
|
3
elements/Avatar/AvatarNoTip.pixy
Normal file
3
elements/Avatar/AvatarNoTip.pixy
Normal file
@ -0,0 +1,3 @@
|
||||
component AvatarNoTip(user *arn.User)
|
||||
a.user(href=user.Link(), title=user.Nick)
|
||||
AvatarNoLink(user)
|
7
elements/Avatar/CustomAvatar.pixy
Normal file
7
elements/Avatar/CustomAvatar.pixy
Normal file
@ -0,0 +1,7 @@
|
||||
component CustomAvatar(user *arn.User, link string, title string)
|
||||
a.user.tip(href=link, aria-label=title)
|
||||
AvatarNoLink(user)
|
||||
|
||||
if user.IsPro()
|
||||
.user-pro-icon
|
||||
RawIcon("star")
|
5
elements/Avatar/ProfileImage.pixy
Normal file
5
elements/Avatar/ProfileImage.pixy
Normal file
@ -0,0 +1,5 @@
|
||||
component ProfileImage(user *arn.User)
|
||||
if user.HasAvatar()
|
||||
img.profile-image.lazy(data-src=user.AvatarLink("large"), data-webp="true", alt="Profile image", importance="high")
|
||||
else
|
||||
SVGProfileImage(user)
|
9
elements/Avatar/SVGAvatar.pixy
Normal file
9
elements/Avatar/SVGAvatar.pixy
Normal file
@ -0,0 +1,9 @@
|
||||
component SVGAvatar(user *arn.User)
|
||||
svg.user-image(viewBox="0 0 50 50")
|
||||
circle.head(cx="25", cy="19", r="10")
|
||||
circle.body(cx="25", cy="50", r="20")
|
||||
|
||||
if len(user.Nick) <= 6
|
||||
text.svg-nick(x="25", y="44", text-anchor="middle")= user.Nick
|
||||
else
|
||||
text.svg-nick(x="25", y="44", text-anchor="middle")= user.Nick[:6]
|
4
elements/Avatar/SVGProfileImage.pixy
Normal file
4
elements/Avatar/SVGProfileImage.pixy
Normal file
@ -0,0 +1,4 @@
|
||||
component SVGProfileImage(user *arn.User)
|
||||
svg.profile-image(viewBox="0 0 50 50", alt="Profile image")
|
||||
circle.head(cx="25", cy="19", r="10")
|
||||
circle.body(cx="25", cy="50", r="20")
|
Reference in New Issue
Block a user