feat: move svg props to the icons file

Audric these are the files to cherry pick
pull/3056/head
William Grant 1 year ago
parent adb9166a11
commit 1048a7411c

@ -70,6 +70,7 @@ export type SessionIconType =
| 'doubleCheckCircle' | 'doubleCheckCircle'
| 'gallery' | 'gallery'
| 'session' | 'session'
| 'recoveryPassword'
| 'stop' | 'stop'
| 'thumbnail' | 'thumbnail'
| 'timerFixed' | 'timerFixed'
@ -90,7 +91,19 @@ export type SessionIconType =
export type SessionIconSize = 'tiny' | 'small' | 'medium' | 'large' | 'huge' | 'huge2' | 'max'; export type SessionIconSize = 'tiny' | 'small' | 'medium' | 'large' | 'huge' | 'huge2' | 'max';
export const icons: Record<string, { path: string; viewBox: string; ratio: number }> = { export type ClipRule = 'nonzero' | 'evenodd' | 'inherit';
export type FillRule = 'nonzero' | 'evenodd';
type IconProps = {
path: string;
viewBox: string;
ratio: number;
fill?: string;
clipRule?: ClipRule;
fillRule?: FillRule;
};
export const icons: Record<string, IconProps> = {
addUser: { addUser: {
path: path:
'M8.85,2.17c-1.73,0-3.12,1.4-3.12,3.12s1.4,3.12,3.12,3.12c1.73,0,3.13-1.4,3.13-3.12S10.58,2.17,8.85,2.17z M8.85,0.08c2.88,0,5.21,2.33,5.21,5.21s-2.33,5.21-5.21,5.21s-5.2-2.33-5.2-5.21C3.65,2.42,5.98,0.08,8.85,0.08z M20.83,5.29 c0.54,0,0.98,0.41,1.04,0.93l0.01,0.11v2.08h2.08c0.54,0,0.98,0.41,1.04,0.93v0.12c0,0.54-0.41,0.98-0.93,1.04l-0.11,0.01h-2.08 v2.08c0,0.58-0.47,1.04-1.04,1.04c-0.54,0-0.98-0.41-1.04-0.93l-0.01-0.11v-2.08h-2.08c-0.54,0-0.98-0.41-1.04-0.93l-0.01-0.11 c0-0.54,0.41-0.98,0.93-1.04l0.11-0.01h2.08V6.34C19.79,5.76,20.26,5.29,20.83,5.29z M12.5,12.58c2.8,0,5.09,2.21,5.2,4.99v0.22 v2.08c0,0.58-0.47,1.04-1.04,1.04c-0.54,0-0.98-0.41-1.04-0.93l-0.01-0.11v-2.08c0-1.67-1.3-3.03-2.95-3.12h-0.18H5.21 c-1.67,0-3.03,1.3-3.12,2.95v0.18v2.08c0,0.58-0.47,1.04-1.04,1.04c-0.54,0-0.98-0.41-1.04-0.93L0,19.88V17.8 c0-2.8,2.21-5.09,4.99-5.2h0.22h7.29V12.58z', 'M8.85,2.17c-1.73,0-3.12,1.4-3.12,3.12s1.4,3.12,3.12,3.12c1.73,0,3.13-1.4,3.13-3.12S10.58,2.17,8.85,2.17z M8.85,0.08c2.88,0,5.21,2.33,5.21,5.21s-2.33,5.21-5.21,5.21s-5.2-2.33-5.2-5.21C3.65,2.42,5.98,0.08,8.85,0.08z M20.83,5.29 c0.54,0,0.98,0.41,1.04,0.93l0.01,0.11v2.08h2.08c0.54,0,0.98,0.41,1.04,0.93v0.12c0,0.54-0.41,0.98-0.93,1.04l-0.11,0.01h-2.08 v2.08c0,0.58-0.47,1.04-1.04,1.04c-0.54,0-0.98-0.41-1.04-0.93l-0.01-0.11v-2.08h-2.08c-0.54,0-0.98-0.41-1.04-0.93l-0.01-0.11 c0-0.54,0.41-0.98,0.93-1.04l0.11-0.01h2.08V6.34C19.79,5.76,20.26,5.29,20.83,5.29z M12.5,12.58c2.8,0,5.09,2.21,5.2,4.99v0.22 v2.08c0,0.58-0.47,1.04-1.04,1.04c-0.54,0-0.98-0.41-1.04-0.93l-0.01-0.11v-2.08c0-1.67-1.3-3.03-2.95-3.12h-0.18H5.21 c-1.67,0-3.03,1.3-3.12,2.95v0.18v2.08c0,0.58-0.47,1.04-1.04,1.04c-0.54,0-0.98-0.41-1.04-0.93L0,19.88V17.8 c0-2.8,2.21-5.09,4.99-5.2h0.22h7.29V12.58z',
@ -446,6 +459,15 @@ export const icons: Record<string, { path: string; viewBox: string; ratio: numbe
viewBox: '0 0 766.2 102.3', viewBox: '0 0 766.2 102.3',
ratio: 7.4897360704, ratio: 7.4897360704,
}, },
recoveryPassword: {
path:
'M49.335 1.05C50.829.356 52.39 0 53.975 0l.022.045c1.54 0 3.056.334 4.574 1.026 1.851.871 3.747 1.697 5.644 2.523l2.186.96 10.284 4.598c3.349 1.489 6.697 2.98 10.047 4.473a8052.21 8052.21 0 0014.538 6.466c4.573 2.031 7.072 6.16 6.692 10.96-.029.26-.02.614-.01 1.013.005.217.01.448.01.684.023.558.023 1.138.023 1.808-.067 6.094-.067 12.3 0 18.394v.112l-.023.111v2.154c-.022 2.155-.045 4.33-.111 6.44-.112 5.604-1.183 10.917-2.12 14.913l-.067.267-.089.268c-.803 2.724-1.718 5.626-2.9 8.617-1.584 3.929-3.659 7.97-6.358 12.367l-.111.178-.134.179c-3.19 4.688-6.158 8.349-9.325 11.541-5.198 5.224-11.066 9.51-17.468 12.791l-.312.178v.001h-.001a27.43 27.43 0 01-.312.178l-.334.179-.335.156c-3.123 1.384-6.849 2.924-10.931 4.018l-.09.045h-.089c-.982.245-1.986.357-2.945.357-.959 0-1.94-.112-2.99-.379-3.814-1.005-7.696-2.456-11.533-4.309l-.067-.067h-.067c-10.953-5.491-20.055-13.617-27.06-24.13l-.313-.358-.334-.558C9.134 94.203 7.305 90.72 5.81 87.26c-1.224-2.865-2.127-5.666-3.002-8.382l-.054-.168-.335-1.027-.156-.513-.112-.514-.2-.993-.201-.994-.05-.246c-.454-2.2-.92-4.464-1.2-6.852-.497-3.919-.494-7.645-.49-11.215V32.547c0-.3.002-.59.005-.872.005-.54.01-1.048-.005-1.517-.179-4.33 2.097-7.991 6.224-9.889 4.394-1.952 8.782-3.905 13.17-5.858l.004-.002c4.39-1.953 8.778-3.906 13.173-5.86L40.545 5l.335-.156.557-.268.179-.09c.342-.15.686-.304 1.033-.459.626-.28 1.257-.562 1.89-.835l1.4-.619a183.58 183.58 0 003.396-1.524zm11.397 57.693l10.405 5.695a14.999 14.999 0 015.682 5.468 14.762 14.762 0 012.088 7.56 13.695 13.695 0 01-4.085 9.728 14.036 14.036 0 01-9.848 4.036H40.347a11.241 11.241 0 01-4.296-.8 11.134 11.134 0 01-3.652-2.373 10.983 10.983 0 01-2.444-3.58 10.873 10.873 0 010-8.468 10.983 10.983 0 012.444-3.58 11.135 11.135 0 013.652-2.373 11.241 11.241 0 014.296-.799h7.062l-10.407-5.696a15.003 15.003 0 01-5.686-5.467 14.764 14.764 0 01-2.09-7.562 13.696 13.696 0 014.085-9.727 14.037 14.037 0 019.847-4.036h24.627c2.95 0 5.778 1.157 7.864 3.218a10.92 10.92 0 013.258 7.769 10.92 10.92 0 01-3.258 7.769 11.192 11.192 0 01-7.864 3.218h-7.053zm-26.38-2.262a11.575 11.575 0 004.313 4.102L52.35 68.07V56.861c0-.403.16-.79.447-1.075a1.549 1.549 0 011.085-.449h13.902c1.04 0 2.07-.21 3.025-.616a7.686 7.686 0 002.535-1.743 7.576 7.576 0 001.635-2.589c.362-.963.523-1.99.472-3.015-.205-4.08-3.76-7.201-7.89-7.201H43.423c-5.918 0-10.887 4.785-10.747 10.63a11.392 11.392 0 001.676 5.678zm6.218 31.345h24.139c5.92 0 10.889-4.786 10.749-10.623a11.392 11.392 0 00-1.676-5.682 11.573 11.573 0 00-4.315-4.106L55.79 59.93v11.21a1.504 1.504 0 01-.45 1.076 1.541 1.541 0 01-1.09.446H40.347c-1.04.001-2.07.211-3.025.617a7.685 7.685 0 00-2.535 1.744 7.578 7.578 0 00-1.635 2.588 7.506 7.506 0 00-.47 3.016c.203 4.078 3.76 7.2 7.888 7.2z',
viewBox: '0 0 108 128',
ratio: 1.1851851852,
fill: 'none',
clipRule: 'evenodd',
fillRule: 'evenodd',
},
star: { star: {
path: path:
'M9.80779568,8.70262392 C9.66225594,8.99747141 9.38107073,9.20193068 9.05571654,9.24948607 L4.1495,9.9666031 L7.69882113,13.4236419 C7.93469487,13.6533829 8.0423575,13.9845141 7.98669695,14.3090433 L7.14926913,19.1916734 L11.5356371,16.8849265 C11.8270199,16.7316912 12.1751567,16.7316912 12.4665396,16.8849265 L16.8529075,19.1916734 L16.0154797,14.3090433 C15.9598192,13.9845141 16.0674818,13.6533829 16.3033555,13.4236419 L19.8526767,9.9666031 L14.9464601,9.24948607 C14.6211059,9.20193068 14.3399207,8.99747141 14.194381,8.70262392 L12.0010883,4.25925434 L9.80779568,8.70262392 Z M8.24682697,7.3464661 L11.104381,1.55737608 C11.4712164,0.814207972 12.5309603,0.814207972 12.8977957,1.55737608 L15.7553497,7.3464661 L22.1457165,8.28051393 C22.9656312,8.40035674 23.2924147,9.40819801 22.6988211,9.98635811 L18.0756101,14.4893656 L19.166697,20.8509567 C19.3068155,21.6679189 18.4492666,22.2908819 17.7156371,21.9050735 L12.0010883,18.8998497 L6.28653961,21.9050735 C5.55291004,22.2908819 4.69536119,21.6679189 4.83547972,20.8509567 L5.92656655,14.4893656 L1.30335554,9.98635811 C0.709762006,9.40819801 1.03654545,8.40035674 1.85646012,8.28051393 L8.24682697,7.3464661', 'M9.80779568,8.70262392 C9.66225594,8.99747141 9.38107073,9.20193068 9.05571654,9.24948607 L4.1495,9.9666031 L7.69882113,13.4236419 C7.93469487,13.6533829 8.0423575,13.9845141 7.98669695,14.3090433 L7.14926913,19.1916734 L11.5356371,16.8849265 C11.8270199,16.7316912 12.1751567,16.7316912 12.4665396,16.8849265 L16.8529075,19.1916734 L16.0154797,14.3090433 C15.9598192,13.9845141 16.0674818,13.6533829 16.3033555,13.4236419 L19.8526767,9.9666031 L14.9464601,9.24948607 C14.6211059,9.20193068 14.3399207,8.99747141 14.194381,8.70262392 L12.0010883,4.25925434 L9.80779568,8.70262392 Z M8.24682697,7.3464661 L11.104381,1.55737608 C11.4712164,0.814207972 12.5309603,0.814207972 12.8977957,1.55737608 L15.7553497,7.3464661 L22.1457165,8.28051393 C22.9656312,8.40035674 23.2924147,9.40819801 22.6988211,9.98635811 L18.0756101,14.4893656 L19.166697,20.8509567 C19.3068155,21.6679189 18.4492666,22.2908819 17.7156371,21.9050735 L12.0010883,18.8998497 L6.28653961,21.9050735 C5.55291004,22.2908819 4.69536119,21.6679189 4.83547972,20.8509567 L5.92656655,14.4893656 L1.30335554,9.98635811 C0.709762006,9.40819801 1.03654545,8.40035674 1.85646012,8.28051393 L8.24682697,7.3464661',

@ -2,6 +2,7 @@ import styled, { css, keyframes } from 'styled-components';
import { memo } from 'react'; import { memo } from 'react';
import { icons, SessionIconSize, SessionIconType } from '.'; import { icons, SessionIconSize, SessionIconType } from '.';
import { ClipRule, FillRule } from './Icons';
export type SessionIconProps = { export type SessionIconProps = {
iconType: SessionIconType; iconType: SessionIconType;
@ -15,9 +16,6 @@ export type SessionIconProps = {
glowStartDelay?: number; glowStartDelay?: number;
noScale?: boolean; noScale?: boolean;
backgroundColor?: string; backgroundColor?: string;
fill?: string;
clipRule?: ClipRule;
fillRule?: FillRule;
dataTestId?: string; dataTestId?: string;
}; };
@ -45,9 +43,6 @@ const getIconDimensionFromIconSize = (iconSize: SessionIconSize | number) => {
} }
}; };
type ClipRule = 'nonzero' | 'evenodd' | 'inherit';
type FillRule = 'nonzero' | 'evenodd';
type StyledSvgProps = { type StyledSvgProps = {
width: string | number; width: string | number;
height: string | number; height: string | number;
@ -189,9 +184,6 @@ export const SessionIcon = (props: SessionIconProps) => {
noScale, noScale,
backgroundColor, backgroundColor,
iconPadding, iconPadding,
fill,
clipRule = 'nonzero',
fillRule = 'nonzero',
dataTestId, dataTestId,
} = props; } = props;
let { iconSize, iconRotation } = props; let { iconSize, iconRotation } = props;
@ -201,6 +193,9 @@ export const SessionIcon = (props: SessionIconProps) => {
const iconDimensions = getIconDimensionFromIconSize(iconSize); const iconDimensions = getIconDimensionFromIconSize(iconSize);
const iconDef = icons[iconType]; const iconDef = icons[iconType];
const ratio = iconDef?.ratio || 1; const ratio = iconDef?.ratio || 1;
const fill = iconDef?.fill || undefined;
const clipRule = iconDef?.clipRule || 'nonzero';
const fillRule = iconDef?.fillRule || 'nonzero';
return ( return (
<SessionSvg <SessionSvg

Loading…
Cancel
Save