Skip to content

Commit

Permalink
More using of notEmpty helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhin committed Sep 27, 2023
1 parent f06b01e commit a9803af
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,35 @@ Read more: [APCA in a Nutshell](https://git.apcacontrast.com/documentation/APCA_
## Installation

Clone the repository:

```bash
git clone https://github.com/evil-martians/figma-polychrom.git
```

Navigate to the project directory:

```bash
cd figma-polychrom
```

Install the dependencies:

```bash
pnpm install
```

## Development

Run the development server:

```bash
pnpm dev
```

## Build

Build the plugin:

```bash
pnpm build
```
Expand Down
4 changes: 3 additions & 1 deletion src/api/services/figma/nodes/collect-node-parents.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { notEmpty } from '~utils/not-empty.ts';

export const collectNodeParents = (
node: PageNode | SceneNode,
parents: SceneNode[] = []
): SceneNode[] => {
if (node.parent != null) {
if (notEmpty(node.parent)) {
if (node.parent.type === 'PAGE' || node.parent.type === 'DOCUMENT')
return parents;

Expand Down
2 changes: 1 addition & 1 deletion src/api/services/payload/build-pair-selection-payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const buildPairSelectionPayload = (

const nodePairPayload = buildColorsPair(fg.id, fgFill, bgFill);

return nodePairPayload != null
return notEmpty(nodePairPayload)
? { selectedNodePairs: [nodePairPayload], selectedNodes: selection }
: buildEmptyPayload();
};
3 changes: 2 additions & 1 deletion src/ui/components/ContrastSample.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { notEmpty } from '~utils/not-empty.ts';
import clsx from 'clsx';
import { type ReactElement } from 'react';

Expand All @@ -23,7 +24,7 @@ export const ContrastSample = ({
className={clsx(
size === 'small' ? 'h-9 w-9 text-xxs' : 'h-13 w-13 text-base',
'flex items-center justify-center rounded-lg text-base',
borderColor != null ? 'border-0.5' : null
notEmpty(borderColor) ? 'border-0.5' : null
)}
style={{
backgroundColor: bgColor,
Expand Down

0 comments on commit a9803af

Please sign in to comment.