Skip to content
Snippets Groups Projects
Commit 9983cd67 authored by Shibin Das's avatar Shibin Das
Browse files

Issue #3456455 refactor 'pill' component to be based on core sdc components

parent 21c02d3d
No related branches found
No related tags found
No related merge requests found
$schema: https://git.drupalcode.org/project/drupal/-/raw/10.1.x/core/modules/sdc/src/metadata.schema.json
name: Pill
description: A pill represents an inline element that can be viewed with or without an icon.
props:
type: object
properties:
color:
title: Color
type: string
enum:
- blue
- gray
- red
- green
- yellow
- indigo
- purple
- pink
label:
title: Label
type: string
libraryOverrides:
dependencies:
- pm_ui/theme
File moved
{{ attach_library('pm/ui.pill') }}
<span class="pm-ui pm-ui-pill pm-ui-pill--color-{{ color }}">
{{ label }}
</span>
File moved
name: 'PM UI'
type: module
description: 'UI elements for PM modules'
core_version_requirement: ^9 || ^10 || ^11
package: 'Project Management'
dependencies:
- drupal:sdc
theme:
css:
theme:
css/theme.css: {}
......@@ -4,3 +4,6 @@ package: Project Management
type: module
core_version_requirement: ^10
dependencies:
- pm:pm_ui
<?php
/**
* @file
* PM Module's install file.
*/
/**
* Install "pm_ui" module.
* @return void
*/
function pm_update_94001() {
$modules = ['pm_ui'];
\Drupal::service('module_installer')->install($modules);
}
ui.theme:
version: 1.x
css:
theme:
templates/ui/theme/theme.css: {}
ui.pill:
version: 1.x
css:
theme:
templates/ui/pill/pill.css: {}
dependencies:
- pm/ui.theme
......@@ -28,9 +28,9 @@ class PmuiPillsFormatter extends EntityReferenceFormatterBase {
$entities = $this->getEntitiesToView($items, $langcode);
foreach ($entities as $delta => $entity) {
$element[$delta] = [
'#type' => 'inline_template',
'#template' => '{% include "@pm/ui/pill/pill.twig" %}',
'#context' => [
'#type' => 'component',
'#component' => 'pm_ui:pill',
'#props' => [
'color' => $entity->get('color')->value,
'label' => $entity->label(),
],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment