Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/aurora/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@plone/components": "workspace:*",
"@plone/contents": "workspace:*",
"@plone/helpers": "workspace:*",
"@plone/icons": "workspace:*",
"@plone/layout": "workspace:*",
"@plone/plate": "workspace:*",
"@plone/publicui": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions apps/aurora/registry.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const addons = [
'@plone/publicui',
'@plone/contents',
'@plone/agave',
'@plone/icons',
];
const theme = '';

Expand Down
2 changes: 2 additions & 0 deletions packages/icons/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
dist/
6 changes: 6 additions & 0 deletions packages/icons/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
news
towncrier.toml
.changelog.draft
node_modules/
.release-it.json
.eslintrc.js
30 changes: 30 additions & 0 deletions packages/icons/.release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"plugins": {
"../scripts/prepublish.js": {}
},
"hooks": {
"after:bump": [
"pipx run towncrier build --draft --yes --version ${version} > .changelog.draft",
"pipx run towncrier build --yes --version ${version}",
"pnpm build"
],
"after:release": "rm .changelog.draft"
},
"npm": {
"publish": false
},
"git": {
"commitArgs": ["--no-verify"],
"changelog": "pipx run towncrier build --draft --yes --version 0.0.0",
"requireUpstream": false,
"requireCleanWorkingDir": false,
"commitMessage": "Release @plone/icons ${version}",
"tagName": "plone-icons-${version}",
"tagAnnotation": "Release @plone/icons ${version}"
},
"github": {
"release": true,
"releaseName": "@plone/icons ${version}",
"releaseNotes": "cat .changelog.draft"
}
}
9 changes: 9 additions & 0 deletions packages/icons/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# @plone/icons Release Notes

<!-- Do *NOT* add new change log entries to this file.
You should create a file in the news directory instead.
For helpful instructions, please see:
https://6.docs.plone.org/contributing/index.html#contributing-change-log-label
-->

<!-- towncrier release notes start -->
25 changes: 25 additions & 0 deletions packages/icons/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Project settings
include ../../variables.mk

.PHONY: all
all: help

.PHONY: help
help: ## This help message
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/$(CYAN)\1$(RESET):\2/' | column -c2 -t -s :)"

.PHONY: install
install: ## Install dependencies
pnpm install

.PHONY: build
build: ## Build the package
pnpm run --if-present build

# .PHONY: storybook-start
# storybook-start: ## Start Storybook
# pnpm run storybook

# .PHONY: storybook-build
# storybook-build: ## Build Storybook
# pnpm run build-storybook
40 changes: 40 additions & 0 deletions packages/icons/components/Icon/Icon.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { afterEach, describe, expect, it } from 'vitest';
import { render, screen } from '@testing-library/react';
import config from '@plone/registry';
import Icon from './Icon';

describe('Icon', () => {
afterEach(() => {
config.icons = {};
});

it('renders a registered icon by name', () => {
const RegisteredIcon = () => (
<svg role="img" aria-label="registered-icon" />
);

config.registerIcon('registered', RegisteredIcon);

render(<Icon name="registered" />);

expect(
screen.getByRole('img', { name: 'registered-icon' }),
).toBeInTheDocument();
});

it('does not render when the icon is missing', () => {
const { container } = render(<Icon name="missing" />);

expect(container).toBeEmptyDOMElement();
});

it('renders the exact registered component, not a fallback', () => {
const CustomIcon = () => <svg data-testid="custom-icon" />;

config.registerIcon('custom', CustomIcon);

render(<Icon name="custom" />);

expect(screen.getByTestId('custom-icon')).toBeInTheDocument();
});
});
19 changes: 19 additions & 0 deletions packages/icons/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import config from '@plone/registry';

interface IconProps {
name: string;
}

const Icon = (props: IconProps) => {
const { name } = props;

const IconComponent = config.getIcon(name);

if (IconComponent === undefined) {
return null;
}

return <IconComponent />;
};

export default Icon;
3 changes: 3 additions & 0 deletions packages/icons/icons/add.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/icons/icons/align-center.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/icons/icons/align-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/icons/icons/align-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions packages/icons/icons/archive.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/arrow-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/arrow-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/arrow-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/arrow-topright.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/arrow-up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/attachment.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions packages/icons/icons/automated-content.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/background.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/icons/icons/bin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/blind.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/bold.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/calendar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/checkbox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/chevron-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/chevron-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/chevron-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/chevron-up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/icons/icons/code.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/icons/collection.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions packages/icons/icons/column-after.svg
10 changes: 10 additions & 0 deletions packages/icons/icons/column-before.svg
4 changes: 4 additions & 0 deletions packages/icons/icons/column-delete.svg
3 changes: 3 additions & 0 deletions packages/icons/icons/columns.svg
4 changes: 4 additions & 0 deletions packages/icons/icons/copy.svg
3 changes: 3 additions & 0 deletions packages/icons/icons/cut.svg
3 changes: 3 additions & 0 deletions packages/icons/icons/dash.svg
3 changes: 3 additions & 0 deletions packages/icons/icons/discussion.svg
3 changes: 3 additions & 0 deletions packages/icons/icons/draggable.svg
4 changes: 4 additions & 0 deletions packages/icons/icons/edit.svg
Loading
Loading