Giter VIP home page Giter VIP logo

Comments (7)

vovayatsyuk avatar vovayatsyuk commented on June 10, 2024 1

I'll leave the script I've used to generate unique ids here in case lipis/flag-icons will not be interested in PR.

<?php

$files = new RecursiveIteratorIterator(
    new RecursiveDirectoryIterator(
        'svg',
        FilesystemIterator::SKIP_DOTS
    )
);

$rules = [
    '/ id="([a-z])"/' => ' id="{CODE}-$1"',
    '/ xlink:href="#([a-z])"/' => ' xlink:href="#{CODE}-$1"',
    '/"url\(#([a-z])\)"/' => '"url(#{CODE}-$1)"',
];

foreach ($files as $file) {
    $code = $file->getBasename('.svg');
    $fileObj = $file->openFile('r+');
    $contents = $fileObj->fread($file->getSize());

    $compiledRules = [];
    foreach ($rules as $key => $value) {
        $compiledRules[$key] = str_replace('{CODE}', $code, $value);
    }

    $contents = preg_replace(
        array_keys($compiledRules),
        array_values($compiledRules),
        $contents
    );

    $fileObj->rewind();
    $fileObj->fwrite($contents);
}

from flags.

vovayatsyuk avatar vovayatsyuk commented on June 10, 2024

Just tagged the new release with updated icons. Try to update, maybe new icons will fix the issue.

from flags.

BrekiTomasson avatar BrekiTomasson commented on June 10, 2024

Nope, problem remains after updating to v1.0.6, unfortunately.

Cameroon's flag normally:

image

Cameroon's flag after changing sort order of the table:

image

Hovering over the <g fill="#fcd116" [...]> element when flag is as intended:

image

Hovering over the <g fill="#fcd116" [...]> element when flag is in broken state:

image

from flags.

vovayatsyuk avatar vovayatsyuk commented on June 10, 2024

I was able to reproduce similar issue at codepen. Looks like an issue caused by duplicated ids in these flags.

Codepen with sortable table: https://codepen.io/vovayatsyuk/pen/eYrPXgW?editors=1000

  1. At the initial page load, the Honduras flag is corrupted.
  2. When changing sort order by clicking on the table header Cameroon and Indian flags get corrupted.

from flags.

vovayatsyuk avatar vovayatsyuk commented on June 10, 2024

I've updated codepen with additional table where I've added -COUNTRY_CODE suffix to all ids.

Here is a result:

Screenshot

@lipis have you ever noticed such behaviour?

from flags.

BrekiTomasson avatar BrekiTomasson commented on June 10, 2024

Good catch, I totally missed that one, but it makes a lot of sense in the context.

from flags.

vovayatsyuk avatar vovayatsyuk commented on June 10, 2024

I've just tagged the new release. The issue should be fixed now.

from flags.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.