-
Notifications
You must be signed in to change notification settings - Fork 801
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AI Title Optimization: Add modal content (#37003)
* AI Title: Add modal content and options * changelog * AI Title: Fix whitespace * AI Title: Avoid calling map directly
- Loading branch information
1 parent
734e054
commit 78533e8
Showing
7 changed files
with
194 additions
and
6 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
projects/plugins/jetpack/changelog/add-title-optimization-content
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,4 @@ | ||
Significance: minor | ||
Type: other | ||
|
||
Add title optimization modal content |
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 |
---|---|---|
|
@@ -7,7 +7,6 @@ | |
display: flex; | ||
flex-direction: column; | ||
width: 100vw; | ||
max-width: 720px; | ||
} | ||
|
||
&__header { | ||
|
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,23 @@ | ||
.jetpack-ai-title-optimization { | ||
&__loading { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 16px; | ||
width: 100%; | ||
height: 200px; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
&__intro { | ||
margin-top: 16px; | ||
} | ||
|
||
&__cta { | ||
display: flex; | ||
gap: 8px; | ||
justify-content: flex-end; | ||
align-items: center; | ||
margin-top: 16px; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...plugins/ai-assistant-plugin/components/title-optimization/title-optimization-options.scss
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,24 @@ | ||
.jetpack-ai-title-optimization__options { | ||
margin-top: 16px; | ||
} | ||
|
||
.jetpack-ai-title-optimization__option { | ||
display: flex; | ||
justify-content: center; | ||
align-items: start; | ||
gap: 16px; | ||
margin-bottom: 16px; | ||
|
||
& > input { | ||
margin-top: 8px; | ||
} | ||
|
||
&-content { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
&-label { | ||
font-weight: 600; | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
.../plugins/ai-assistant-plugin/components/title-optimization/title-optimization-options.tsx
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,51 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import './title-optimization-options.scss'; | ||
|
||
type TitleOptimizationOptions = { | ||
value: string; | ||
label: string; | ||
description: string; | ||
}[]; | ||
|
||
const id = 'title-optimization-option'; | ||
|
||
export default function TitleOptimizationOptions( { | ||
options, | ||
selected, | ||
onChangeValue, | ||
}: { | ||
options: TitleOptimizationOptions; | ||
selected: string; | ||
onChangeValue: ( event: React.ChangeEvent< HTMLInputElement > ) => void; | ||
} ) { | ||
return ( | ||
<div className="jetpack-ai-title-optimization__options"> | ||
{ options.map( ( option, index ) => ( | ||
<div className="jetpack-ai-title-optimization__option" key={ `${ id }-${ index }` }> | ||
<input | ||
id={ `${ id }-${ index }` } | ||
className="jetpack-ai-title-optimization__option-input" | ||
type="radio" | ||
name={ id } | ||
value={ option.value } | ||
onChange={ onChangeValue } | ||
checked={ option.value === selected } | ||
/> | ||
<div className="jetpack-ai-title-optimization__option-content"> | ||
<label | ||
className="jetpack-ai-title-optimization__option-label" | ||
htmlFor={ `${ id }-${ index }` } | ||
> | ||
{ option.label } | ||
</label> | ||
<span className="jetpack-ai-title-optimization__option-description"> | ||
{ option.description } | ||
</span> | ||
</div> | ||
</div> | ||
) ) } | ||
</div> | ||
); | ||
} |