Skip to content
Snippets Groups Projects
Commit 916e54b1 authored by utkarsh_33's avatar utkarsh_33 Committed by Chris Wells
Browse files

Issue #3503137: The ProjectIcon component should accept an image prop, or...

Issue #3503137: The ProjectIcon component should accept an image prop, or figure out its image internally
parent 1db616d5
No related branches found
No related tags found
1 merge request!703#3503137: The ProjectIcon component should accept an image prop, or figure out its image internally
Pipeline #418222 canceled
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
// eslint-disable-next-line import/no-mutable-exports,import/prefer-default-export // eslint-disable-next-line import/no-mutable-exports,import/prefer-default-export
export let project; export let project;
const drupalSetting = drupalSettings;
const { Drupal } = window; const { Drupal } = window;
const processMultipleProjects = MAX_SELECTIONS === null || MAX_SELECTIONS > 1; const processMultipleProjects = MAX_SELECTIONS === null || MAX_SELECTIONS > 1;
...@@ -59,11 +58,7 @@ ...@@ -59,11 +58,7 @@
<ProjectStatusIndicator {project} statusText={Drupal.t('Not compatible')} /> <ProjectStatusIndicator {project} statusText={Drupal.t('Not compatible')} />
{:else if project.status === 'active'} {:else if project.status === 'active'}
<ProjectStatusIndicator {project} statusText={Drupal.t('Installed')}> <ProjectStatusIndicator {project} statusText={Drupal.t('Installed')}>
{#if 'gin' in drupalSetting && drupalSetting.gin.darkmode === '1'} <ProjectIcon type="installed" />
<ProjectIcon type="greenInstalled" />
{:else}
<ProjectIcon type="installed" />
{/if}
</ProjectStatusIndicator> </ProjectStatusIndicator>
{:else} {:else}
<span> <span>
......
<script> <script>
import { FULL_MODULE_PATH, DARK_COLOR_SCHEME } from '../constants'; import { FULL_MODULE_PATH, DARK_COLOR_SCHEME } from '../constants';
const { Drupal } = window; const { Drupal, drupalSettings } = window;
// eslint-disable-next-line import/no-mutable-exports,import/prefer-default-export
export let type = ''; export let type = '';
export let variant = false; export let variant = false;
export let classes = false; export let classes = false;
...@@ -37,18 +37,22 @@ ...@@ -37,18 +37,22 @@
alt: Drupal.t('Installed'), alt: Drupal.t('Installed'),
title: Drupal.t('This project is installed.'), title: Drupal.t('This project is installed.'),
}, },
greenInstalled: {
path: 'green-checkmark-icon',
alt: Drupal.t('Installed'),
title: Drupal.t('This module is installed.'),
},
}; };
const { alt, title } = typeToImg[type];
let { path } = typeToImg[type];
if (
'gin' in drupalSettings &&
drupalSettings.gin.darkmode === '1' &&
type === 'installed'
) {
path = 'green-checkmark-icon';
}
</script> </script>
{#if type === 'installed'} {#if type === 'installed'}
<span class="pb-project__status-icon-span" title={typeToImg[type].title}> <span class="pb-project__status-icon-span" {title}>
<img <img
src="{FULL_MODULE_PATH}/images/{typeToImg[type].path}{DARK_COLOR_SCHEME src="{FULL_MODULE_PATH}/images/{path}{DARK_COLOR_SCHEME
? '--dark-color-scheme' ? '--dark-color-scheme'
: ''}.svg" : ''}.svg"
class={`pb-icon pb-icon--${variant} pb-icon--${type} ${classes}`} class={`pb-icon pb-icon--${variant} pb-icon--${type} ${classes}`}
...@@ -62,7 +66,7 @@ ...@@ -62,7 +66,7 @@
? '--dark-color-scheme' ? '--dark-color-scheme'
: ''}.svg" : ''}.svg"
class={`pb-icon pb-icon--${variant} pb-icon--${type} ${classes}`} class={`pb-icon pb-icon--${variant} pb-icon--${type} ${classes}`}
alt={typeToImg[type].alt} {alt}
/> />
</button> </button>
{/if} {/if}
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