Skip to content

Commit

Permalink
Adding text decoration
Browse files Browse the repository at this point in the history
Fixing camel case style prop name
  • Loading branch information
ramonjd committed May 2, 2022
1 parent 97ef4c7 commit be71be4
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/blocks/src/api/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export const __EXPERIMENTAL_STYLE_PROPERTY = {
textDecoration: {
value: [ 'typography', 'textDecoration' ],
support: [ 'typography', '__experimentalTextDecoration' ],
useEngine: true,
},
textTransform: {
value: [ 'typography', 'textTransform' ],
Expand Down
2 changes: 1 addition & 1 deletion packages/style-engine/src/styles/typography/fontSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const fontSize = {
? [
{
selector: options?.selector,
key: 'font-size',
key: 'fontSize',
value: styleValue,
},
]
Expand Down
3 changes: 2 additions & 1 deletion packages/style-engine/src/styles/typography/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
*/
import fontSize from './fontSize';
import lineHeight from './lineHeight';
import textDecoration from './textDecoration';

export default [ fontSize, lineHeight ];
export default [ fontSize, lineHeight, textDecoration ];
2 changes: 1 addition & 1 deletion packages/style-engine/src/styles/typography/lineHeight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const lineHeight = {
? [
{
selector: options?.selector,
key: 'line-height',
key: 'lineHeight',
value: styleValue,
},
]
Expand Down
32 changes: 32 additions & 0 deletions packages/style-engine/src/styles/typography/textDecoration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* External dependencies
*/
import { get } from 'lodash';

/**
* Internal dependencies
*/
import type { Style, StyleOptions } from '../../types';

const textDecoration = {
name: 'lineHeight',
generate: ( style: Style, options: StyleOptions ) => {
const styleValue: string | undefined = get(
style,
[ 'typography', 'textDecoration' ],
null
);

return styleValue
? [
{
selector: options?.selector,
key: 'textDecoration',
value: styleValue,
},
]
: [];
},
};

export default textDecoration;

0 comments on commit be71be4

Please sign in to comment.