Create a base `Icon` to derive from when creating icons
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- react, typescript
Direzione di ricerca
Inizia individuando gli IconProps e i componenti delle icone esistenti nel frontend di Sistent, quindi confronta le relative variabili e costanti condivise con l’implementazione proposta di SistentIcon. Il lavoro è completato quando un’icona di base riutilizzabile supporta children, MUI sx props, color, title e i preset di dimensione definiti, e le icone duplicate sono state refactorizzate per utilizzarla.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Current Behavior
We have multiple icons that needs to be refactored to reduce duplication on variables and constants, and rather rely on one icon to use from.
Desired Behavior
- Create base
SistentIcon - Widen the
IconPropsto includesxprops as an optional field to be used with MUI - Add
sizefield inIconPropsto provide the default sizes forxsmall,small,medium,large, andxlarge
Implementation
The below describes the SistentIcon that will wraps the svg path or else with Box, doesn't have to be box, it can be a div.
The children was changed to allow child elements within the div or Box
export type IconSize = "xsmall" | "small" | "medium" | "large";
export type IconProps = {
children?: React.ReactNode;
color?: string;
title?: string;
width?: number | string;
height?: number | string;
size?: IconSize;
sx?: SxProps<Theme>;
} & Omit<BoxProps, "sx"> &
React.SVGProps<SVGSVGElement>;
const iconSizes: Record<IconSize, { width: number; height: number }> = {
xsmall: { width: 16, height: 16 },
small: { width: 24, height: 24 },
medium: { width: 32, height: 32 },
large: { width: 40, height: 40 },
};
export default function SistentIcon({
color,
title,
size = "medium",
fill = CHARCOAL_FILL,
viewBox,
sx,
children,
...rest
}: IconProps) {
const { width, height } = iconSizes[size];
return (
<Box
component={"svg"}
xmlns="http://www.w3.org/2000/svg"
width={width}
height={height}
viewBox={viewBox}
fill={fill || color}
sx={sx}
{...rest}
>
{title && <title>{title}</title>}
{children}
</Box>
);
}
The fill will be a default color, in this case charcoal. This can be changed inline in project specific. You can also use sx props from MUI in order to use the theme inline.
<IconButton
aria-label="close"
onClick={onClose}
sx={(theme) => ({
"&:hover": {
"& svg": {
fill: theme.palette.keppelGreen,
},
},
})}
disableRipple
>
<CloseIcon
sx={(theme) => ({
fill: theme.palette.charcoal,
})}
/>
</IconButton>
Acceptance Tests
Mockups
- 🎨 Wireframes and designs for Sistent site in Figma (open invite)
- Lingua principale
- TypeScript
- Stelle
- 137
- Fork
- 239
- Merge medio
- 4g 14h
- PR unite (30g)
- 5
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di layer5io/sistent
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
component/ui help wanted kind/enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
ESM build is not loadable by Node: extensionless 'lodash/debounce' specifier in dist/index.mjs Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
kind/bug
Tutte le issue di layer5io/sistent
Issue simili
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Crush Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
ElementsProject/cln-application#167 · 1 commento · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Quantco/pnpm-licenses#17 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100