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

style: [M3-6639] - Add outline to country flags that contain white #9288

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use boxShadow
bnussman committed Jun 22, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 8b8d9ac6fdbfb2db1ab38f5e15ff6c56b27965ff
15 changes: 3 additions & 12 deletions packages/manager/src/components/Flag.tsx
Original file line number Diff line number Diff line change
@@ -2,14 +2,11 @@ import React from 'react';
import 'flag-icons/css/flag-icons.min.css';
import { Country } from './EnhancedSelect/variants/RegionSelect/utils';
import { styled } from '@mui/material/styles';
import { isPropValid } from 'src/utilities/isPropValid';

const COUNTRY_FLAG_OVERRIDES = {
uk: 'gb',
};

const COUNTRIES_TO_OUTLINE = ['jp', 'id', 'sg'];

interface Props {
country: Lowercase<Country>;
}
@@ -23,20 +20,14 @@ export const Flag = (props: Props) => {
return (
<StyledFlag
className={`fi fi-${COUNTRY_FLAG_OVERRIDES[country] ?? country} fi-xx`}
hasOutline={COUNTRIES_TO_OUTLINE.includes(country)}
/>
);
};

const StyledFlag = styled('div', {
label: 'StyledFlag',
shouldForwardProp: (prop) => isPropValid(['hasOutline'], prop),
})<{ hasOutline: boolean }>(({ theme, ...props }) => ({
const StyledFlag = styled('div', { label: 'StyledFlag' })(({ theme }) => ({
fontSize: '1.5rem',
outline:
props.hasOutline && theme.palette.mode === 'light'
? `1px solid ${theme.color.border3}`
: 'none',
boxShadow:
theme.palette.mode === 'light' ? `0px 0px 0px 1px #00000010` : undefined,
verticalAlign: 'top',
width: '1.41rem',
}));