Skip to content

Conversation

@KamiSpo
Copy link

@KamiSpo KamiSpo commented Aug 18, 2019

Komponent jest funkcjonalny, wymaga jeszcze drobnych poprawek (np. nie można zmienić rozmiaru pojedynczego stepa). Steps, które mają określony state, mają zaaplikowane defaultowe kolory. Jeśli state nie jest określony, można im dowolnie zmieniać kolor tła i kolor fontu. Teraz ikony można zmieniać dowolnie, ale mogę dodać defaultowe ikony dla state = success i state = error.

@KamiSpo KamiSpo requested a review from KonradSzwarc August 18, 2019 10:47
});

export const StepContent = (props: StepContentProps) => {
const StepContent =
Copy link
Member

Choose a reason for hiding this comment

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

Tę logikę lepiej wyrzuć do jakiejś funkcji, to łatwiej będzie to czytać. Najlepiej zrobić switch

let updatedChildren = React.Children.map(child.props.children as ReactElement[], (innerChild, index) => {
if (index === 0) {
return React.cloneElement(innerChild as ReactElement, { state: state, children: number });
} else {
Copy link
Member

Choose a reason for hiding this comment

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

Skoro w if powyżej znajduje się return, to else nie jest konieczne. Wystarczy, że zostawisz samą jego zawartość.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants