-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/icon/text-color
* develop: (28 commits) fix:readme修正 fix:バージョン番号修正 lint Fix: screen-reader-textを削除 revert revert refactor: deorecated処理しやすく変更 lint リファクタリング Add: window. fix:「ブロック名 + link」でなくて「ブロック名 」になっていたのを修正 Fix: Swapped "color" and "layout" Revert block.json to develop version Fix: changelog Fix: changelog Fix: changelog Add support for layout.allowJustification: false to allow full/wide align e2eテスト用ファイル修正 e2eテスト用ファイル追加 deprecate修正 ... # Conflicts: # readme.txt
- Loading branch information
Showing
13 changed files
with
331 additions
and
142 deletions.
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
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
109 changes: 109 additions & 0 deletions
109
src/blocks/_pro/gridcolcard-item/deprecated/1.95.0/save.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,109 @@ | ||
import { InnerBlocks, useBlockProps } from '@wordpress/block-editor'; | ||
import { isHexColor } from '@vkblocks/utils/is-hex-color'; | ||
import { isGradientStyle } from '@vkblocks/utils/is-gradient-style'; | ||
|
||
import classnames from 'classnames'; | ||
|
||
export default function save(props) { | ||
const { attributes } = props; | ||
const { | ||
backgroundColor, | ||
textColor, | ||
headerDisplay, | ||
footerDisplay, | ||
containerSpace, | ||
borderRadius, | ||
border, | ||
borderColor, | ||
borderWidth, | ||
backgroundGradient, | ||
url, | ||
urlOpenType, | ||
} = attributes; | ||
|
||
// カラーパレットに対応 | ||
const containerClasses = classnames('vk_gridcolcard_item', { | ||
[`vk_gridcolcard_item-noHeader`]: headerDisplay === 'delete', | ||
[`vk_gridcolcard_item-noFooter`]: footerDisplay === 'delete', | ||
[`has-background`]: !!backgroundColor, | ||
[`has-border-color`]: !!border, | ||
[`has-${backgroundColor}-background-color`]: | ||
!!backgroundColor && !isHexColor(backgroundColor), | ||
[`has-${backgroundGradient}-gradient-background`]: | ||
!!backgroundGradient && !isGradientStyle(backgroundGradient), | ||
[`has-${borderColor}-border-color`]: | ||
!!border && !!borderColor && !isHexColor(borderColor), | ||
}); | ||
|
||
const innerClasses = classnames('vk_gridcolcard_item_container', { | ||
[`has-text-color`]: !!textColor, | ||
[`has-${textColor}-color`]: !!textColor && !isHexColor(textColor), | ||
}); | ||
|
||
const style = { | ||
backgroundColor: null, | ||
border: null, | ||
}; | ||
if (borderRadius) { | ||
style.borderRadius = `${borderRadius}`; | ||
} | ||
|
||
// 背景色 | ||
if (backgroundColor && isHexColor(backgroundColor)) { | ||
// custom color | ||
style.backgroundColor = `${backgroundColor}`; | ||
} | ||
|
||
// 背景グラデーション | ||
if (backgroundGradient && isGradientStyle(backgroundGradient)) { | ||
// custom color | ||
style.background = `${backgroundGradient}`; | ||
} | ||
|
||
// 線の色と太さ | ||
if (border) { | ||
style.borderWidth = borderWidth; | ||
if (isHexColor(borderColor)) { | ||
// custom color | ||
style.borderColor = `${borderColor}`; | ||
} | ||
} | ||
|
||
// 文字色 | ||
const textColorCustom = | ||
textColor && isHexColor(textColor) ? textColor : null; | ||
|
||
const blockProps = useBlockProps.save({ | ||
className: classnames(containerClasses, { | ||
'vk_gridcolcard_item-noHeader': headerDisplay === 'delete', | ||
'vk_gridcolcard_item-noFooter': footerDisplay === 'delete', | ||
[`vk_gridcolcard_item-header-${headerDisplay}`]: | ||
headerDisplay !== 'delete', | ||
[`vk_gridcolcard_item-footer-${footerDisplay}`]: | ||
footerDisplay !== 'delete', | ||
}), | ||
style, | ||
}); | ||
|
||
const TagName = url ? 'a' : 'div'; | ||
|
||
return ( | ||
<div {...blockProps}> | ||
<TagName | ||
className={innerClasses} | ||
style={{ | ||
paddingTop: containerSpace.top, | ||
paddingBottom: containerSpace.bottom, | ||
paddingLeft: containerSpace.left, | ||
paddingRight: containerSpace.right, | ||
color: textColorCustom, | ||
}} | ||
href={url} | ||
target={urlOpenType ? '_blank' : undefined} | ||
rel={urlOpenType ? 'noopener noreferrer' : undefined} | ||
> | ||
<InnerBlocks.Content /> | ||
</TagName> | ||
</div> | ||
); | ||
} |
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
Oops, something went wrong.