Skip to content

Chinese taipei flag size - #15404

Open
vihaan-cherukuri wants to merge 3 commits into
thewca:mainfrom
vihaan-cherukuri:chinese-taipei-flag-size
Open

Chinese taipei flag size#15404
vihaan-cherukuri wants to merge 3 commits into
thewca:mainfrom
vihaan-cherukuri:chinese-taipei-flag-size

Conversation

@vihaan-cherukuri

Copy link
Copy Markdown
Contributor

Fixes #14593

WcaFlag special-cases the Chinese Taipei ("TW") country code to render a custom _TwFlag icon, but it dropped every prop passed to it (width/height/className/style). Every call site sizes its flag via Chakra's <Icon asChild size="..."> wrapper, which injects sizing through those props — so Chinese Taipei's flag ignored the intended size and
rendered oversized everywhere else.

This forwards those props to _TwFlag the same way they're already forwarded to the regular react-world-flags <Flag>.

WcaFlag special-cases the TW country code to render a custom
_TwFlag icon but dropped all width/height/className/style props
passed to it, so it ignored the Icon size wrapper used by every
call site and rendered oversized.

Fixes thewca#14593
Copilot AI lite review requested due to automatic review settings August 20, 2026 13:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes incorrect sizing for the Chinese Taipei (“TW”) flag in the Next.js frontend by ensuring sizing-related props are forwarded to the custom _TwFlag icon, aligning behavior with the standard react-world-flags rendering path.

Changes:

  • Forward width/height/className/style from WcaFlag to the TW-specific _TwFlag icon.
  • Pass the same sizing/styling props explicitly to the standard react-world-flags <Flag> component.
  • Update ESLint configuration to include the import plugin and enforce a basic import grouping order.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
next-frontend/src/components/WcaFlag.tsx Updates TW special-case rendering to forward sizing/styling props so it respects Chakra Icon asChild sizing.
.eslintrc.json Adds import plugin and enables import/order rule for grouped import ordering.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +18 to +22
<_TwFlag
width={width}
height={height}
className={className}
style={style}
@FinnIckler

Copy link
Copy Markdown
Member

why not just spread the rest props to the flag from the start? no need to add more props

@vihaan-cherukuri

Copy link
Copy Markdown
Contributor Author

@FinnIckler Thanks for the response! I already tried that, but it doesn't type-check. FlagProps (HTMLImageElement) and _TwFlag (Chakra SVG) have incompatible event handlers. Only forward compatible props: width, height, className, style.

@gregorbg gregorbg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for your contribution! I second Finn in that explicitly naming individual props is too verbose. I have made a suggestion in-line about which intersection type might be useful to solve this.

Comment thread .eslintrc.json

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These are unrelated changes. If you want to suggest improvements to our Eslint setup, please open them as a separate PR

Comment on lines +8 to +15
const WcaFlag = ({
code,
width,
height,
className,
style,
...restProps
}: FlagProps) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you're worried about type safety, then use an intersection type between FlagProps and whatever other component props are relevant

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The _TwFlag helper is created via the Chakra createIcon helper, which effectively gives it the same props as an Icon ChakraUI component.

So if you read ComponentPropsWithoutRef<typeof Icon>, that should give you a steady base for intersection typing of ...restProps.

Revert unrelated ESLint import-order change and forward props to
_TwFlag via an intersection type (FlagProps & Icon props) instead of
naming each prop individually.
@vihaan-cherukuri

Copy link
Copy Markdown
Contributor Author

@gregorbg and @FinnIckler thank you guys so much for the feedback. I addressed both the points and it should be good, please let me know if you need anything else!

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.

"Chinese Taipei" flag is too large

4 participants