Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiIcon] Add crossInCircle glyph #7924

Merged
merged 15 commits into from
Aug 5, 2024
2 changes: 2 additions & 0 deletions packages/eui/changelogs/upcoming/7924.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Added/Updated ...
cee-chen marked this conversation as resolved.
Show resolved Hide resolved

1 change: 1 addition & 0 deletions packages/eui/src-docs/src/views/icon/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export const iconTypes = [
'copy',
'copyClipboard',
'cross',
'crossInCircle',
'crosshairs',
'currency',
'cut',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,40 @@ exports[`EuiIcon props type crossClusterReplicationApp is rendered 1`] = `
</svg>
`;

exports[`EuiIcon props type crossInCircle is rendered 1`] = `
<svg
aria-hidden="true"
class="euiIcon emotion-euiIcon-m-isLoaded"
data-icon-type="crossInCircle"
data-is-loaded="true"
fill="none"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<g
clip-path="url(#crossInCircle_generated-id_a)"
>
<path
clip-rule="evenodd"
d="m8.755 8 2.64 2.641a.534.534 0 1 1-.754.755L8 8.755l-2.641 2.64a.534.534 0 1 1-.755-.754L7.245 8l-2.64-2.641a.534.534 0 1 1 .754-.755L8 7.245l2.641-2.64a.534.534 0 1 1 .755.754L8.755 8Zm4.904-5.66c3.121 3.121 3.121 8.199 0 11.32-3.12 3.12-8.198 3.12-11.318 0C-.78 10.538-.78 5.46 2.34 2.34c3.12-3.12 8.198-3.12 11.319 0Zm-.665.666a7.062 7.062 0 1 0-9.988 9.988 7.062 7.062 0 0 0 9.988-9.988Z"
/>
</g>
<defs>
<clippath
id="crossInCircle_generated-id_a"
>
<path
d="M0 0h16v16H0z"
fill="#fff"
/>
</clippath>
</defs>
</svg>
`;

exports[`EuiIcon props type crosshairs is rendered 1`] = `
<svg
aria-hidden="true"
Expand Down
49 changes: 49 additions & 0 deletions packages/eui/src/components/icon/assets/crossInCircle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

// THIS IS A GENERATED FILE. DO NOT MODIFY MANUALLY. @see scripts/compile-icons.js

import * as React from 'react';
import type { SVGProps } from 'react';
import { htmlIdGenerator } from '../../../services';
interface SVGRProps {
title?: string;
titleId?: string;
}
const EuiIconCrossInCircle = ({
title,
titleId,
...props
}: SVGProps<SVGSVGElement> & SVGRProps) => {
const generateId = htmlIdGenerator('crossInCircle');
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width={16}
height={16}
fill="none"
viewBox="0 0 16 16"
aria-labelledby={titleId}
{...props}
>
{title ? <title id={titleId}>{title}</title> : null}
<g clipPath={`url(#${generateId('a')})`}>
<path
d="m8.755 8 2.64 2.641a.534.534 0 1 1-.754.755L8 8.755l-2.641 2.64a.534.534 0 1 1-.755-.754L7.245 8l-2.64-2.641a.534.534 0 1 1 .754-.755L8 7.245l2.641-2.64a.534.534 0 1 1 .755.754L8.755 8Zm4.904-5.66c3.121 3.121 3.121 8.199 0 11.32-3.12 3.12-8.198 3.12-11.318 0C-.78 10.538-.78 5.46 2.34 2.34c3.12-3.12 8.198-3.12 11.319 0Zm-.665.666a7.062 7.062 0 1 0-9.988 9.988 7.062 7.062 0 0 0 9.988-9.988Z"
clipRule="evenodd"
/>
</g>
<defs>
<clipPath id={generateId('a')}>
<path fill="#fff" d="M0 0h16v16H0z" />
</clipPath>
</defs>
</svg>
);
};
export const icon = EuiIconCrossInCircle;
1 change: 1 addition & 0 deletions packages/eui/src/components/icon/icon_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export const typeToPathMap = {
createSingleMetricJob: 'ml_create_single_metric_job',
cross: 'cross',
crossClusterReplicationApp: 'app_cross_cluster_replication',
crossInCircle: 'crossInCircle',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the SVG file name is update, you'll also need to update this.

Suggested change
crossInCircle: 'crossInCircle',
crossInCircle: 'cross_in_circle',

crosshairs: 'crosshairs',
currency: 'currency',
cut: 'cut',
Expand Down
10 changes: 10 additions & 0 deletions packages/eui/src/components/icon/svgs/crossInCircle.svg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks as though the circle's stroke is slightly less than 1px. Any chance we could make it exactly 1px to avoid any subpixel blurriness?

CleanShot 2024-07-29 at 15 47 31

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank Michael, sorry for all that discrepancies! Honestly, I just created my form based on outlined plus we already have. Considering other outlined icons we have, I'm a bit lost which template to stick to. You can see, these +/- differ from what's on your screenshot. It means we'll have to change all those outlined icons later too, right @MichaelMarcialis?
CleanShot 2024-07-30 at 10 11 17@2x

Also, the cross inside looks like also not 1px folk. Is in intentionally more for filled icon? Isn't it blurry then? Maybe we can also correct this glyph, while we're here?
CleanShot 2024-07-30 at 10 04 55@2x

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, all good points. These are just some of the many discrepancies and inconsistencies we need to correct in general in the icon library.

Anyway, for the purposes of this PR, I'd suggest proceeding with the comment recommendations, even they create inconsistency with some of those similar examples you shared. We'll eventually update those other ones to match. Alternatively, if you have the time and willingness, please do feel free to adjust them as part of this PR. But no pressure. Assuming we continue to maintain our custom icon library, I have it on my to-do list to make these sorts of adjustments in the near future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that the endpoints for the x symbol don't sit perfectly on the pixel grid, unlike its sister crossInCircleFilled icon. Would you mind adjusting so that the endpoints are the same as crossInCircleFilled?

CleanShot 2024-07-29 at 15 45 57

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We typically try to minify and strip any non-essential information from the SVG files. In this case, we could remove all fill attributes, the g container, and the defs. Doing so would yield SVG code similar to this:

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
  <path d="m8.755 8 2.64 2.641a.534.534 0 1 1-.754.755L8 8.755l-2.641 2.64a.533.533 0 1 1-.755-.754L7.244 8l-2.64-2.641a.534.534 0 1 1 .755-.755l2.64 2.641 2.642-2.64a.534.534 0 1 1 .755.754L8.755 8Zm4.904-5.66c3.12 3.121 3.12 8.199 0 11.32-3.12 3.12-8.198 3.12-11.318 0C-.78 10.538-.78 5.46 2.34 2.34c3.12-3.12 8.198-3.12 11.319 0Zm-.665.666a7.062 7.062 0 1 0-9.988 9.987 7.062 7.062 0 0 0 9.988-9.987Z"/>
</svg>

After making updates based on previous comments, mind scrubbing these extraneous elements from your updated SVG file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this file's name from crossInCircle.svg to cross_in_circle.svg? I know there's currently a mix of snake and camel case in the SVGs folder currently, but we'll be updating them all to snake case going forward.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading