-
Notifications
You must be signed in to change notification settings - Fork 904
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
Updates the styling of the AI buttons #21415
Merged
mhkuu
merged 34 commits into
feature/fix-assessments
from
update-styling-of-sparkle-buttons-ai-assessment-fixes
Jun 7, 2024
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
fcb83ed
Creates initial structure
Jordi-PV 2f168bd
Merge branch 'feature/fix-assessments' of github.com:Yoast/wordpress-…
Jordi-PV b605b3c
Adds color variables + gradients
Jordi-PV ed6049f
Refactor AI button style component
Jordi-PV f0b360e
Removes props to apply gradient effect
Jordi-PV 35eaf22
Refactor AI-button
Jordi-PV 990bad3
Adds background-image
Jordi-PV 733da3f
Cleans unused code
Jordi-PV fab5973
Adds button border css rules
Jordi-PV dda0ada
Merge remote-tracking branch 'origin/feature/fix-assessments' into up…
mykola c7253de
Update styling of Toast and AI sparkle buttons (AI assessment fixes)
mykola 29f2e80
Updates SparklesIcon
Jordi-PV 896540e
Merge branch 'update-styling-of-sparkle-buttons-ai-assessment-fixes' …
Jordi-PV d227426
Adjust backgrounds
Jordi-PV e07e6a0
Adds border rule
Jordi-PV e14a843
Refactors hover state image
Jordi-PV eb918b7
Adds a box-shadow to the pressed state of the button.
Jordi-PV cf42c04
Adds the JSDoc to the SparklesIcon
Jordi-PV af64698
Corrects the JSDoc to the SparklesIcon
Jordi-PV 334070f
Update styling of Toast and AI sparkle buttons (AI assessment fixes)
mykola 2abba05
Merge branch 'update-styling-of-sparkle-buttons-ai-assessment-fixes' …
mykola c538ffe
Correct linter errors
Jordi-PV e1109db
Corrects failing lint errors
Jordi-PV e5270c7
Corrects indentation
Jordi-PV df25616
Adds the clip-path property
Jordi-PV c05f993
Solves conflicts
Jordi-PV 2e475a6
Solves lint errors
Jordi-PV 2285d41
Removes unused props
Jordi-PV 9965f4b
Removes disabled state
Jordi-PV b5290cb
Updates snapshots
Jordi-PV e4abfa5
Separates sparkles-icon and renames file
Jordi-PV 43fa03c
Corrects lint errors
Jordi-PV 3d67393
Added prop validation
vraja-pro 6053238
add snapshot test
vraja-pro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import styled from "styled-components"; | ||
import { rgba } from "@yoast/style-guide"; | ||
import IconButtonBase from "./IconButtonBase"; | ||
|
||
const yoastPrimary50 = "#FAF3F7"; | ||
const yoastPrimary100 = "#F3E5ED"; | ||
const yoastPrimary300 = "#CD82AB"; | ||
const yoastPrimary400 = "#B94986"; | ||
const yoastPrimary500 = "#A61E69"; | ||
const blue50 = "#EFF6FF"; | ||
const blue100 = "#DBEAFE"; | ||
const blue300 = "#93C5FD"; | ||
const blue500 = "#3B82F6"; | ||
|
||
const direction = "to bottom right"; | ||
|
||
const gradientEffect = { | ||
defaultStateBackground: `linear-gradient(${direction}, ${yoastPrimary50}, ${blue50})`, | ||
defaultStateBorder: `linear-gradient(${direction}, ${yoastPrimary300}, ${blue300}) 1`, | ||
hoverStateBackground: `linear-gradient(${direction}, ${yoastPrimary100}, ${blue100})`, | ||
pressedStateBackground: `linear-gradient(${direction}, ${yoastPrimary500}, ${blue500})`, | ||
}; | ||
|
||
const AIFixesButtonBase = styled( IconButtonBase )` | ||
overflow: hidden; | ||
border: ${ props => props.pressed ? "none" : "1px solid transparent" }; | ||
border-image: ${ props => props.pressed ? "none" : gradientEffect.defaultStateBorder }; | ||
clip-path: inset(0 round 3px); | ||
background-image: ${ props => props.pressed | ||
? gradientEffect.pressedStateBackground | ||
: gradientEffect.defaultStateBackground } !important; | ||
box-shadow: ${ props => props.pressed | ||
? `inset 0 -2px 0 ${ yoastPrimary400 }` | ||
: `0 1px 0 ${ rgba( props.unpressedBoxShadowColor, 0.7 ) }` }; | ||
&:hover { | ||
background-image: ${ props => props.pressed | ||
? gradientEffect.pressedStateBackground | ||
: gradientEffect.hoverStateBackground } !important; | ||
} | ||
`; | ||
|
||
export default AIFixesButtonBase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/js/src/ai-assessment-fixes/components/sparkles-icon.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import propTypes from "prop-types"; | ||
|
||
/** | ||
* The AI Assessment Fixes button icon. | ||
* @param {boolean} pressed Whether the button is pressed. | ||
* @returns {JSX.Element} The AI Assessment Fixes button icon. | ||
*/ | ||
export const SparklesIcon = ( { pressed = false } ) => { | ||
return ( | ||
<> | ||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path | ||
d="M3.33284 2V4.66667M1.99951 3.33333H4.66618M3.99951 11.3333V14M2.66618 12.6667H5.33284M8.66618 2L10.19 6.57143L13.9995 8L10.19 9.42857L8.66618 14L7.14237 9.42857L3.33284 8L7.14237 6.57143L8.66618 2Z" | ||
stroke={ pressed ? "white" : "url(#paint0_linear_1208_188)" } strokeWidth="1.33333" strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
<defs> | ||
<linearGradient | ||
id="paint0_linear_1208_188" x1="0" y1="0" x2="16" y2="16" | ||
gradientUnits="userSpaceOnUse" | ||
> | ||
<stop stopColor="#A61E69" /> | ||
<stop offset="1" stopColor="#3B82F6" /> | ||
</linearGradient> | ||
</defs> | ||
</svg> | ||
</> | ||
); | ||
}; | ||
|
||
SparklesIcon.propTypes = { | ||
pressed: propTypes.bool, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think we should add a snapshot test for this one @Jordi-PV
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.
Update: I took care of that