-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement/9335 SiWG Setup Banner CTA #9560
Changes from all commits
3400e19
2cc6c60
3b50de1
8331c77
2e4a887
ed1180f
b434064
7c1990c
bae2ef2
b7dc295
10a0faf
9c7d34c
752e6e7
4501e0b
91d7d25
9fc7ccc
b7fc278
2ccf7b4
b07e844
49ae608
fc367db
12e76df
a0153d9
709ddb5
8197a3a
6760c33
b973c6f
91ed246
5aed12c
86fbcc3
78e6e73
7d9e0c9
085135f
9306ce8
9f3fbd9
c7f8100
410f8f5
1837264
b05aeec
eefddb4
5007f73
d2b1001
0857a1b
fc87f14
3a3caf2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,9 +19,13 @@ | |
*/ | ||
import { sanitizeHTML } from '../../../../util'; | ||
|
||
export default function Description( { text, learnMoreLink } ) { | ||
export default function Description( { | ||
className = 'googlesitekit-publisher-win__desc', | ||
text, | ||
learnMoreLink, | ||
} ) { | ||
return ( | ||
<div className="googlesitekit-publisher-win__desc"> | ||
<div className={ className }> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here; let's use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same reasoning as above. |
||
<p> | ||
<span | ||
dangerouslySetInnerHTML={ sanitizeHTML( text, { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/** | ||
* Site Kit by Google, Copyright 2024 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* External dependencies | ||
*/ | ||
import classNames from 'classnames'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { | ||
BREAKPOINT_SMALL, | ||
BREAKPOINT_TABLET, | ||
useBreakpoint, | ||
} from '../../../../hooks/useBreakpoint'; | ||
import { Cell, Grid, Row } from '../../../../material-components'; | ||
|
||
export default function NotificationWithSVG( { | ||
id, | ||
title, | ||
description, | ||
actions, | ||
SVG, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Capital prop names are a bit odd. I'm guessing it's done so you can use Looks like we do this elsewhere too, so no need to change it, but I guess leaving my comment here so it's recognised 😆 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, this just clearly screams that we need a component as a prop here - similar to how we use pass |
||
} ) { | ||
const breakpoint = useBreakpoint(); | ||
|
||
// Desktop breakpoint. | ||
let svgSizeProps = { mdSize: 8, lgSize: 6 }; | ||
// Tablet breakpoint. | ||
if ( breakpoint === BREAKPOINT_TABLET ) { | ||
svgSizeProps = { mdSize: 8 }; | ||
} | ||
// Mobile breakpoint. | ||
if ( breakpoint === BREAKPOINT_SMALL ) { | ||
svgSizeProps = { smSize: 12 }; | ||
} | ||
|
||
return ( | ||
<div className="googlesitekit-widget-context"> | ||
<Grid className="googlesitekit-widget-area"> | ||
<Row> | ||
<Cell size={ 12 }> | ||
<div | ||
className={ classNames( | ||
'googlesitekit-widget', | ||
'googlesitekit-widget--no-padding', | ||
'googlesitekit-setup-cta-banner', | ||
`googlesitekit-setup-cta-banner--${ id }` | ||
) } | ||
> | ||
<div className="googlesitekit-widget__body"> | ||
<Grid collapsed> | ||
<Row> | ||
<Cell | ||
smSize={ 12 } | ||
mdSize={ 8 } | ||
lgSize={ 6 } | ||
className="googlesitekit-setup-cta-banner__primary-cell" | ||
> | ||
<h3 className="googlesitekit-setup-cta-banner__title"> | ||
{ title } | ||
</h3> | ||
|
||
{ description } | ||
|
||
{ actions } | ||
</Cell> | ||
<Cell | ||
alignBottom | ||
className={ `googlesitekit-setup-cta-banner__svg-wrapper--${ id }` } | ||
{ ...svgSizeProps } | ||
> | ||
<SVG /> | ||
</Cell> | ||
</Row> | ||
</Grid> | ||
</div> | ||
</div> | ||
</Cell> | ||
</Row> | ||
</Grid> | ||
</div> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't allow developers to replace the existing class name, I'd think… so we should do this instead:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand, but here, the class name is essentially a flag for the version we need to use for this component. Unfortunately,
googlesitekit-publisher-win__actions
andgooglesitekit-setup-cta-banner__actions-wrapper
are conflicting with each other - so we can either apply one or the other. If we were to useclassnames
, we would have to create another flag liketype
or something solely for styling. Type could then bebanner-notification
orsetup-cta
. And then we'd have to switch the classname based on the type. Ideally, we should be refactoring the legacy banner notifications (viz. all classes withgooglesitekit-publisher-win*
) soon.So is this worth add the whole type flag, etc or should I leave this as is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess in that case we can leave it as-is, fair enough.