Skip to content

Commit

Permalink
Merge a0c8e5b into 275bdac
Browse files Browse the repository at this point in the history
  • Loading branch information
agliga committed Apr 24, 2024
2 parents 275bdac + a0c8e5b commit fdcb101
Show file tree
Hide file tree
Showing 10 changed files with 1,200 additions and 1,013 deletions.
25 changes: 0 additions & 25 deletions scripts/import-svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,32 +224,13 @@ function generateIcon(componentName) {
}

function generateFlagComponent(iconMap) {
const text = [
`import type { WithNormalizedProps } from "../../global";
static interface FlagInput extends Omit<Marko.Input<"span">, \`on\${string}\`> {
flag?: string;
}
export interface Input extends WithNormalizedProps<FlagInput> {}
$ const {
flag
} = input;
<if(!flag)></if>\n`,
];
const twoDititCountries = getCountries();
const countries = {};
for (const [name] of iconMap) {
const countryMap = twoDititCountries.find(
(country) => country === name.slice(5).toUpperCase(),
);
if (countryMap && tempIgnore.indexOf(countryMap) === -1) {
text.push(`<else-if(flag === "${countryMap}")>
<ebay-${name} />
</else-if>
`);

const country = {
countryCode: countryMap,
callingCode: getCountryCallingCode(countryMap),
Expand All @@ -264,12 +245,6 @@ $ const {
countries[countryMap] = country;
}
}

fs.writeFileSync(
path.join(outputBaseDir, "ebay-flag", "index.marko"),
text.join(""),
);

fs.writeFileSync(
path.join(outputCommonDir, "countries", "countries.ts"),
`export default ${JSON.stringify(countries)};`,
Expand Down

0 comments on commit fdcb101

Please sign in to comment.