Skip to content

Commit ca77546

Browse files
committed
add to friend like profile-pane
1 parent 707a5d6 commit ca77546

2 files changed

Lines changed: 43 additions & 39 deletions

File tree

src/social/socialPane.css

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@
5656
flex-wrap: wrap;
5757
}
5858

59+
.social-pane__header-actions--friend {
60+
justify-content: center;
61+
}
62+
63+
.social-pane__header-actions--friend > solid-ui-button {
64+
margin-inline: auto;
65+
--button-border-radius: var(--border-radius-md, 0.5rem);
66+
--button-hover-text: var(--color-primary, #7C4DFF);
67+
--button-hover-border: var(--color-primary, #7C4DFF);
68+
}
69+
5970
.social-pane__header-summary {
6071
gap: var(--spacing-xs, 0.75rem);
6172
width: fit-content;
@@ -156,33 +167,6 @@
156167
stroke: none;
157168
}
158169

159-
.social-pane__friend-action {
160-
position: static;
161-
width: auto;
162-
min-width: 0;
163-
max-width: none;
164-
padding: var(--spacing-xxs, 0.3125rem) var(--spacing-xs, 0.75rem);
165-
gap: var(--spacing-xxs, 0.3125rem);
166-
border-radius: var(--border-radius-md, 0.5rem);
167-
border: 1px solid var(--color-primary, #7C4DFF);
168-
background: transparent;
169-
color: var(--color-primary, #7C4DFF);
170-
cursor: pointer;
171-
font: inherit;
172-
font-weight: var(--font-weight-bold, 600);
173-
font-size: var(--font-size-sm, 0.875rem);
174-
line-height: 1.2;
175-
}
176-
177-
.social-pane__friend-action:hover {
178-
background: rgb(124 77 255 / 0.06);
179-
}
180-
181-
.social-pane__friend-action:focus-visible {
182-
outline: var(--border-width-medium, 2px) solid var(--color-primary, #7C4DFF);
183-
outline-offset: 2px;
184-
}
185-
186170
.social-pane__dialog-backdrop {
187171
position: fixed;
188172
inset: 0;
@@ -1059,6 +1043,16 @@ div.social-pane {
10591043
margin-left: 0;
10601044
}
10611045

1046+
:is(.social-pane-host, .social-pane)[data-layout='mobile'] .social-pane__header-actions--friend {
1047+
grid-column: 1 / -1;
1048+
grid-row: 3;
1049+
justify-self: stretch;
1050+
justify-content: center;
1051+
width: 100%;
1052+
margin-left: 0;
1053+
margin-top: 0.125rem;
1054+
}
1055+
10621056
:is(.social-pane-host, .social-pane)[data-layout='mobile'] .social-pane__header-summary {
10631057
display: flex;
10641058
flex-direction: column;
@@ -1137,12 +1131,6 @@ div.social-pane {
11371131
font-size: var(--font-size-xxs, 0.75rem);
11381132
}
11391133

1140-
:is(.social-pane-host, .social-pane)[data-layout='mobile'] .social-pane__friend-action {
1141-
padding: var(--spacing-xxxs, 0.2rem) var(--spacing-xxs-old, 0.3rem);
1142-
font-size: var(--font-size-xs, 0.813rem);
1143-
border-radius: var(--border-radius-base, 0.3125rem);
1144-
}
1145-
11461134
:is(.social-pane-host, .social-pane)[data-layout='mobile'] :is(.social-pane__edit-button-label, .social-pane__edit-button .profile-section-collapsible__edit-label) {
11471135
display: none !important;
11481136
}
@@ -1258,6 +1246,16 @@ div.social-pane {
12581246
margin-left: 0;
12591247
}
12601248

1249+
.social-pane__header-actions--friend {
1250+
grid-column: 1 / -1;
1251+
grid-row: 3;
1252+
justify-self: stretch;
1253+
justify-content: center;
1254+
width: 100%;
1255+
margin-left: 0;
1256+
margin-top: 0.125rem;
1257+
}
1258+
12611259
.social-pane__header-summary {
12621260
display: flex;
12631261
flex-direction: column;
@@ -1340,9 +1338,9 @@ div.social-pane {
13401338
}
13411339

13421340
.social-pane__friend-action {
1343-
padding: var(--spacing-xxxs, 0.2rem) var(--spacing-xxs-old, 0.3rem);
1344-
font-size: var(--font-size-xs, 0.813rem);
1345-
border-radius: var(--border-radius-base, 0.3125rem);
1341+
--button-padding-sm: var(--spacing-xxxs, 0.2rem) var(--spacing-xxs-old, 0.3rem);
1342+
--button-font-size-sm: var(--font-size-xs, 0.813rem);
1343+
--button-border-radius-sm: var(--border-radius-base, 0.3125rem);
13461344
}
13471345

13481346
.social-pane__edit-button-label,

src/social/socialSections.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { createAddMeToYourFriendsButton } from 'profile-pane'
21
import { DataBrowserContext } from 'pane-registry'
2+
import { createAddMeToYourFriendsButton } from 'profile-pane/lib/specialButtons/addMeToYourFriends'
33
import { Statement, NamedNode } from 'rdflib'
44
import { ns, utils, widgets } from 'solid-ui'
55
import { appendProfileLinks, createEditProfileDetailsButton } from './editProfileDetails'
@@ -33,6 +33,10 @@ export type HeaderProfileData = {
3333
location?: string | null
3434
} | null
3535

36+
type HeaderCallbacks = {
37+
onAddFriendSuccess?: () => void
38+
}
39+
3640
export type FriendRowRenderers = {
3741
renderSupportingInfo: (target: NamedNode, renderDom: HTMLDocument) => HTMLElement | null,
3842
renderNameSuffix: (target: NamedNode, renderDom: HTMLDocument) => HTMLElement | null
@@ -43,7 +47,8 @@ export function createHeaderSection (
4347
subject: NamedNode,
4448
controls: HeaderControls,
4549
stats: HeaderStats,
46-
getProfileData: () => HeaderProfileData
50+
getProfileData: () => HeaderProfileData,
51+
callbacks: HeaderCallbacks = {}
4752
): SocialHeaderElement {
4853
const dom = context.dom
4954
const kb = context.session.store
@@ -69,8 +74,9 @@ export function createHeaderSection (
6974
onSaved: renderHeader
7075
}))
7176
} else if (headerControls.viewerMode === 'authenticated' && headerControls.showAddFriendAction) {
77+
headerActions.classList.add('social-pane__header-actions--friend')
7278
const addToFriendsButton = createAddMeToYourFriendsButton(subject, context)
73-
addToFriendsButton.classList.add('social-pane__friend-action', 'profile__action-button', 'profile__btn-friends', 'flex-center')
79+
addToFriendsButton.classList.add('flex-center')
7480
headerActions.appendChild(addToFriendsButton)
7581
}
7682

0 commit comments

Comments
 (0)