Skip to content

Commit

Permalink
removed typography component from copyright
Browse files Browse the repository at this point in the history
  • Loading branch information
kancijan committed May 9, 2024
1 parent f3ac117 commit a0abc00
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { selector, checkAttr, classnames, props } from '@eightshift/frontend-libs/scripts';
import { TypographyEditor } from '../../typography/components/typography-editor';
import { RichText } from '@wordpress/block-editor';
import { selector, checkAttr, classnames, getAttrKey } from '@eightshift/frontend-libs/scripts';
import manifest from './../manifest.json';

export const CopyrightEditor = (attributes) => {
Expand All @@ -12,9 +12,11 @@ export const CopyrightEditor = (attributes) => {
selectorClass = componentClass,
blockClass,
additionalClass,
setAttributes
} = attributes;

const copyrightUse = checkAttr('copyrightTypographyUse', attributes, manifest);
const copyrightUse = checkAttr('copyrightUse', attributes, manifest);
const copyrightContent = checkAttr('copyrightContent', attributes, manifest);
const copyrightYear = new Date().getFullYear();

const copyrightClass = classnames(
Expand All @@ -29,8 +31,11 @@ export const CopyrightEditor = (attributes) => {

return (
<div className={copyrightClass}>
&copy;{copyrightYear} | <TypographyEditor
{...props('typography', attributes)}
&copy;{copyrightYear} | <RichText
value={copyrightContent}
onChange={(value) => setAttributes({ [getAttrKey('copyrightContent', attributes, manifest)]: value })}
keepPlaceholderOnFocus
allowedFormats={[]}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ export const CopyrightOptions = (attributes) => {
setAttributes
} = attributes;

const copyrightTypographyUse = checkAttr('copyrightTypographyUse', attributes, manifest);
const copyrightUse = checkAttr('copyrightUse', attributes, manifest);

return (
<Toggle
label={__('Copyright', 'eightshift-frontend-libs')}
checked={copyrightTypographyUse}
onChange={(value) => setAttributes({ [getAttrKey('copyrightTypographyUse', attributes, manifest)]: value })}
checked={copyrightUse}
onChange={(value) => setAttributes({ [getAttrKey('copyrightUse', attributes, manifest)]: value })}
reducedBottomSpacing
/>
);
Expand Down
4 changes: 2 additions & 2 deletions blocks/init/src/Blocks/components/copyright/copyright.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

$manifest = Components::getManifest(__DIR__);

$copyrightUse = Components::checkAttr('copyrightTypographyUse', $attributes, $manifest);
$copyrightUse = Components::checkAttr('copyrightUse', $attributes, $manifest);
if (!$copyrightUse) {
return;
}
Expand All @@ -21,7 +21,7 @@
$selectorClass = $attributes['selectorClass'] ?? $componentClass;

$copyrightYear = date('Y');
$copyrightContent = Components::checkAttr('copyrightTypographyContent', $attributes, $manifest);
$copyrightContent = Components::checkAttr('copyrightContent', $attributes, $manifest);

$copyrightClass = Components::classnames([
Components::selector($componentClass, $componentClass),
Expand Down
19 changes: 7 additions & 12 deletions blocks/init/src/Blocks/components/copyright/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@
"componentName": "copyright",
"title": "Copyright",
"componentClass": "copyright",
"example": {
"attributes": {
"copyrightBy": "Eightshift",
"copyrightTypographyContent": "Made with ❤️ by Team Eightshift",
"copyrightUse": true
}
},
"attributes": {
"copyrightTypographyContent": {
"type": "string"
"copyrightUse": {
"type": "boolean",
"default": true
},
"copyrightContent": {
"type": "string",
"default": "Made with ❤️ by Team Eightshift"
}
},
"components": {
"typography": "typography"
}
}

0 comments on commit a0abc00

Please sign in to comment.