rinvex / countries

Rinvex Country is a simple and lightweight package for retrieving country details with flexibility. A whole bunch of data including name, demonym, capital, iso codes, dialling codes, geo data, currencies, flags, emoji, and other attributes for all 250 countries worldwide at your fingertips.
https://rinvex.com
MIT License
1.66k stars 208 forks source link

Flag is very large #90

Closed mohamedsabil83 closed 5 years ago

mohamedsabil83 commented 6 years ago

Can I change the size of the flag cause it's very large 750 widths and 500 height?

Omranic commented 5 years ago

Sure you can, it's SVG anyway so feel free to use it the way you want :)

ludo237 commented 5 years ago

@mohamedsabil83 @Omranic how can I update the SVG size on demand?

mohamedsabil83 commented 5 years ago

You can do it by setting the Height and Width attributes. You can paste your code for more help.

ludo237 commented 5 years ago

@mohamedsabil83 I actually send the country class to a view using Blase template (from Laravel)

Something like this

<div>{{ $country->getFlag() }}</div>
mohamedsabil83 commented 5 years ago

It's a workarownd. You can do it like this:

Blade

<div class="flag">{!! $country->getFlag() !!}</div>

Css

.flag svg {
    width: 100px;
    height: 50px;
}
ludo237 commented 5 years ago

Damn I should have thought about that. Thank you very much

mohamedsabil83 commented 5 years ago

Your welcome

ludo237 commented 5 years ago

It does not work 😢

shazahm1 commented 5 years ago

CSS should be used to size the flags, the SVG flag files do not need sized because, well, since they are vectors, they have no size (technically).

mohamedsabil83 commented 5 years ago

@ludo237 codepen your code to review it .

ludo237 commented 5 years ago

Never mind my fault, it works as intended!

Sorry

mohamedsabil83 commented 5 years ago

Good to know that.

ludo237 commented 5 years ago

Sorry to brings this up again but I figured out what was wrong, basically it's not me but some flags I am using the style provided by @mohamedsabil83 for this

I mean take a look at the screen shots here, this flag is rendered correctly: image Inspect element of this flag is image

While this clearly is not rendered correctly image Inspect element of this flag is image

Some flags have viewBox and title while other don't, the global style is this for what matters image I'm using bootstrap 4 hence the @extend .mr-2

ludo237 commented 5 years ago

I ended up leveraging a npm package called flag-icon-css then I simply do

image

And it works like a charm.

mohamedsabil83 commented 5 years ago

Yes, It's another way. good to share it.