Skip to content

Commit acf556f

Browse files
committed
Change share button border in galleries meta
1 parent 0a845b7 commit acf556f

File tree

2 files changed

+41
-4
lines changed

2 files changed

+41
-4
lines changed

dotcom-rendering/src/components/ShareButton.importable.tsx

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,16 @@ type ButtonKind = 'native' | 'copy' | 'email';
3535

3636
type Context = 'ArticleMeta' | 'LiveBlock' | 'SubMeta' | 'ImageCaption';
3737

38-
const sharedButtonStyles = (sizeXSmall: boolean) => css`
38+
const sharedButtonStyles = (
39+
sizeXSmall: boolean,
40+
context: Context,
41+
format: ArticleFormat,
42+
) => css`
3943
transition: none;
40-
border-color: ${sizeXSmall
44+
border-color: ${format.design === ArticleDesign.Gallery &&
45+
context == 'ArticleMeta'
46+
? themePalette('--share-button-border-meta')
47+
: sizeXSmall
4148
? themePalette('--share-button-xsmall-border')
4249
: themePalette('--share-button-border')};
4350
height: ${sizeXSmall ? '24px' : '36px'};
@@ -123,11 +130,15 @@ export const CopyNativeShareButton = ({
123130
size,
124131
isLiveBlogMeta,
125132
isCopied,
133+
context,
134+
format,
126135
}: {
127136
onShare: () => void;
128137
size?: Size;
129138
isLiveBlogMeta: boolean;
130139
isCopied: boolean;
140+
context: Context;
141+
format: ArticleFormat;
131142
}) => {
132143
const sizeXSmall = size === 'xsmall';
133144
return (
@@ -142,7 +153,7 @@ export const CopyNativeShareButton = ({
142153
...(isCopied
143154
? [copiedButtonStyles(sizeXSmall)]
144155
: [buttonStyles(sizeXSmall)]),
145-
sharedButtonStyles(sizeXSmall),
156+
sharedButtonStyles(sizeXSmall, context, format),
146157
isLiveBlogMeta && liveBlogMobileMeta(isCopied),
147158
])}
148159
data-gu-name="share-button"
@@ -156,10 +167,14 @@ export const EmailLink = ({
156167
href,
157168
size,
158169
isLiveBlogMeta,
170+
format,
171+
context,
159172
}: {
160173
href: string;
161174
size?: Size;
162175
isLiveBlogMeta: boolean;
176+
format: ArticleFormat;
177+
context: Context;
163178
}) => {
164179
const sizeXSmall = size === 'xsmall';
165180
return (
@@ -172,7 +187,7 @@ export const EmailLink = ({
172187
icon={<SvgShareWeb />}
173188
cssOverrides={css([
174189
buttonStyles(sizeXSmall),
175-
sharedButtonStyles(sizeXSmall),
190+
sharedButtonStyles(sizeXSmall, context, format),
176191
isLiveBlogMeta && liveBlogMobileMeta(false),
177192
])}
178193
>
@@ -261,6 +276,8 @@ export const ShareButton = ({
261276
size={size}
262277
isLiveBlogMeta={isLiveBlogMeta}
263278
isCopied={isCopied}
279+
context={context}
280+
format={format}
264281
/>
265282
);
266283
case 'copy':
@@ -277,6 +294,8 @@ export const ShareButton = ({
277294
size={size}
278295
isLiveBlogMeta={isLiveBlogMeta}
279296
isCopied={isCopied}
297+
context={context}
298+
format={format}
280299
/>
281300
);
282301
case 'email':
@@ -285,6 +304,8 @@ export const ShareButton = ({
285304
href={`mailto:?subject=${webTitle}&body=${shareData.url}`}
286305
size={size}
287306
isLiveBlogMeta={isLiveBlogMeta}
307+
context={context}
308+
format={format}
288309
/>
289310
);
290311
}

dotcom-rendering/src/paletteDeclarations.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3700,6 +3700,18 @@ const shareButtonBorderLight: PaletteFunction = ({ design }) => {
37003700

37013701
const shareButtonBorderDark: PaletteFunction = () => sourcePalette.neutral[20];
37023702

3703+
const shareButtonBorderMetaLight: PaletteFunction = ({ design }) => {
3704+
switch (design) {
3705+
case ArticleDesign.Gallery:
3706+
return sourcePalette.neutral[38];
3707+
default:
3708+
return sourcePalette.neutral[86];
3709+
}
3710+
};
3711+
3712+
const shareButtonBorderMetaDark: PaletteFunction = () =>
3713+
sourcePalette.neutral[20];
3714+
37033715
const shareButtonBorderXSmallLight: PaletteFunction = ({ design }) => {
37043716
switch (design) {
37053717
case ArticleDesign.Gallery:
@@ -7780,6 +7792,10 @@ const paletteColours = {
77807792
light: shareButtonBorderLight,
77817793
dark: shareButtonBorderDark,
77827794
},
7795+
'--share-button-border-meta': {
7796+
light: shareButtonBorderMetaLight,
7797+
dark: shareButtonBorderMetaDark,
7798+
},
77837799
'--share-button-copied': {
77847800
light: shareButtonCopiedLight,
77857801
dark: shareButtonCopiedDark,

0 commit comments

Comments
 (0)