-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The current implementation of Svelte is not working, this is because we don't include Flag.svelte in the output file. This leads to an issue as the file is not defined, however the new attempt also doesn't work for the following reasons: - Will require users to install SASS into their codebase, which isn't desirable - Is seemingly unable to resolve the files that are included in the dist folder. - This code is uncompiled, which may or may not be desirable Relates to: #7
- Loading branch information
1 parent
5110524
commit 79e20b3
Showing
7 changed files
with
294 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ UserInterfaceState.xcuserstate | |
.env | ||
.rpt2_cache/ | ||
.vscode | ||
.dccache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
<script> | ||
import { onMount } from 'svelte'; | ||
export let code = "NL" | ||
export let size = "m" | ||
export let gradient = '' | ||
export let hasBorder = true | ||
export let hasDropShadow = false | ||
export let hasBorderRadius = true | ||
let className | ||
export { className as class } | ||
const lower = (q) => q.toLowerCase() | ||
$: gradient = lower(gradient) | ||
$: size = lower(size) | ||
let Flag | ||
async function importFlag (size, code){ | ||
return import(`./dist/flags/${size}/${code}.svg`) | ||
.then(res => res.default) | ||
} | ||
</script> | ||
|
||
<div class={` | ||
flag | ||
${gradient} | ||
size-${size} | ||
${hasBorder ? 'border' : ''} | ||
${hasDropShadow ? 'drop-shadow' : ''} | ||
${hasBorderRadius ? 'border-radius' : ''} | ||
${className ? className.replace(/\s\s+/g, ' ').trim() : ''} | ||
`}> | ||
|
||
{#await importFlag(size, code) then Flag} | ||
<img src="{Flag}" alt={`Flag of ${code}`}/> | ||
{/await} | ||
|
||
</div> | ||
|
||
<style type="text/scss"> | ||
@mixin before-styling { | ||
content: ''; | ||
width: 100%; | ||
height: 100%; | ||
position: absolute; | ||
display: block; | ||
mix-blend-mode: overlay; | ||
box-sizing: border-box; | ||
} | ||
// Flag | ||
.flag { | ||
display: inline-block; | ||
overflow: hidden; | ||
position: relative; | ||
box-sizing: border-box; | ||
align-items: center; | ||
img { | ||
display: block; | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; | ||
} | ||
&.size { | ||
&-s { | ||
width: 16px; | ||
height: 12px; | ||
&.drop-shadow { | ||
box-shadow: 0 0 1px 0.5px rgba(0,0,0,0.10); | ||
} | ||
&.border-radius { | ||
border-radius: 1px; | ||
&.border { | ||
&::before { | ||
border-radius: 1px; | ||
} | ||
} | ||
} | ||
} | ||
&-m { | ||
width: 20px; | ||
height: 15px; | ||
&.drop-shadow { | ||
box-shadow: 0 1px 2px 0 rgba(0,0,0,0.10); | ||
} | ||
&.border-radius { | ||
border-radius: 1.5px; | ||
&.border { | ||
&::before { | ||
border-radius: 1.5px; | ||
} | ||
} | ||
} | ||
} | ||
&-l { | ||
width: 32px; | ||
height: 24px; | ||
&.drop-shadow { | ||
box-shadow: 0 2px 3px 0 rgba(0,0,0,0.10); | ||
} | ||
&.border-radius { | ||
border-radius: 2px; | ||
&.border { | ||
&::before { | ||
border-radius: 2px; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
&.border { | ||
&::before { | ||
@include before-styling(); | ||
border: 1px solid rgba(0, 0, 0, .5); | ||
mix-blend-mode: overlay; | ||
} | ||
} | ||
&.top-down { | ||
&::before { | ||
@include before-styling(); | ||
background-image: linear-gradient(0deg, rgba(0,0,0,0.30) 2%, rgba(255,255,255,0.70) 100%); | ||
} | ||
} | ||
&.real-linear { | ||
&::before { | ||
@include before-styling(); | ||
background-image: linear-gradient(45deg, rgba(0,0,0,0.20) 0%, rgba(39,39,39,0.22) 11%, rgba(255,255,255,0.30) 27%, rgba(0,0,0,0.24) 41%, rgba(0,0,0,0.55) 52%, rgba(255,255,255,0.26) 63%, rgba(0,0,0,0.27) 74%, rgba(255,255,255,0.30) 100%); | ||
} | ||
} | ||
&.real-circular { | ||
&::before { | ||
@include before-styling(); | ||
background: radial-gradient(50% 36%, rgba(255,255,255,0.30) 0%, rgba(0,0,0,0.24) 11%, rgba(0,0,0,0.55) 17%, rgba(255,255,255,0.26) 22%, rgba(0,0,0,0.17) 27%, rgba(255,255,255,0.28) 31%, rgba(255,255,255,0.00) 37%) center calc(50% - 8px) / 600% 600%, | ||
radial-gradient(50% 123%, rgba(255,255,255,0.30) 25%, rgba(0,0,0,0.24) 48%, rgba(0,0,0,0.55) 61%, rgba(255,255,255,0.26) 72%, rgba(0,0,0,0.17) 80%, rgba(255,255,255,0.28) 88%, rgba(255,255,255,0.30) 100%) center calc(50% - 8px) / 600% 600%; | ||
} | ||
} | ||
} | ||
</style> |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -281,6 +281,26 @@ | |
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" | ||
integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== | ||
|
||
"@types/fs-extra@^8.0.1": | ||
version "8.1.2" | ||
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.1.2.tgz#7125cc2e4bdd9bd2fc83005ffdb1d0ba00cca61f" | ||
integrity sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg== | ||
dependencies: | ||
"@types/node" "*" | ||
|
||
"@types/glob@^7.1.1": | ||
version "7.2.0" | ||
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb" | ||
integrity sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA== | ||
dependencies: | ||
"@types/minimatch" "*" | ||
"@types/node" "*" | ||
|
||
"@types/minimatch@*": | ||
version "3.0.5" | ||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" | ||
integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== | ||
|
||
"@types/minimist@^1.2.0": | ||
version "1.2.2" | ||
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" | ||
|
@@ -722,7 +742,7 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" | ||
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= | ||
|
||
colorette@^1.3.0: | ||
colorette@^1.1.0, colorette@^1.3.0: | ||
version "1.4.0" | ||
resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.4.0.tgz#5190fbb87276259a86ad700bff2c6d6faa3fca40" | ||
integrity sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g== | ||
|
@@ -911,7 +931,7 @@ fast-deep-equal@^3.1.1: | |
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" | ||
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== | ||
|
||
fast-glob@^3.1.1: | ||
fast-glob@^3.0.3, fast-glob@^3.1.1: | ||
version "3.2.7" | ||
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1" | ||
integrity sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q== | ||
|
@@ -975,6 +995,15 @@ form-data@~2.3.2: | |
combined-stream "^1.0.6" | ||
mime-types "^2.1.12" | ||
|
||
fs-extra@^8.1.0: | ||
version "8.1.0" | ||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" | ||
integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== | ||
dependencies: | ||
graceful-fs "^4.2.0" | ||
jsonfile "^4.0.0" | ||
universalify "^0.1.0" | ||
|
||
fs-minipass@^2.0.0: | ||
version "2.1.0" | ||
resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.1.0.tgz#7f5036fdbf12c63c169190cbe4199c852271f9fb" | ||
|
@@ -1064,6 +1093,20 @@ globals@^11.1.0: | |
resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" | ||
integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== | ||
|
||
[email protected]: | ||
version "10.0.1" | ||
resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.1.tgz#4782c34cb75dd683351335c5829cc3420e606b22" | ||
integrity sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A== | ||
dependencies: | ||
"@types/glob" "^7.1.1" | ||
array-union "^2.1.0" | ||
dir-glob "^3.0.1" | ||
fast-glob "^3.0.3" | ||
glob "^7.1.3" | ||
ignore "^5.1.1" | ||
merge2 "^1.2.3" | ||
slash "^3.0.0" | ||
|
||
globby@^11.0.1: | ||
version "11.0.4" | ||
resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.4.tgz#2cbaff77c2f2a62e71e9b2813a67b97a3a3001a5" | ||
|
@@ -1085,7 +1128,7 @@ globule@^1.0.0: | |
lodash "~4.17.10" | ||
minimatch "~3.0.2" | ||
|
||
graceful-fs@^4.2.3: | ||
graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.3: | ||
version "4.2.8" | ||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a" | ||
integrity sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg== | ||
|
@@ -1153,6 +1196,11 @@ http-signature@~1.2.0: | |
jsprim "^1.2.2" | ||
sshpk "^1.7.0" | ||
|
||
ignore@^5.1.1: | ||
version "5.1.9" | ||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.9.tgz#9ec1a5cbe8e1446ec60d4420060d43aa6e7382fb" | ||
integrity sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ== | ||
|
||
ignore@^5.1.4: | ||
version "5.1.8" | ||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" | ||
|
@@ -1227,6 +1275,11 @@ is-plain-obj@^1.1.0: | |
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" | ||
integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= | ||
|
||
is-plain-object@^3.0.0: | ||
version "3.0.1" | ||
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-3.0.1.tgz#662d92d24c0aa4302407b0d45d21f2251c85f85b" | ||
integrity sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g== | ||
|
||
is-reference@^1.2.1: | ||
version "1.2.1" | ||
resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7" | ||
|
@@ -1301,6 +1354,13 @@ json5@^2.1.2: | |
dependencies: | ||
minimist "^1.2.5" | ||
|
||
jsonfile@^4.0.0: | ||
version "4.0.0" | ||
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" | ||
integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= | ||
optionalDependencies: | ||
graceful-fs "^4.1.6" | ||
|
||
jsprim@^1.2.2: | ||
version "1.4.1" | ||
resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" | ||
|
@@ -1383,7 +1443,7 @@ meow@^9.0.0: | |
type-fest "^0.18.0" | ||
yargs-parser "^20.2.3" | ||
|
||
merge2@^1.3.0: | ||
merge2@^1.2.3, merge2@^1.3.0: | ||
version "1.4.1" | ||
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" | ||
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== | ||
|
@@ -1783,6 +1843,17 @@ rollup-plugin-babel-minify@^10.0.0: | |
babel-preset-minify "^0.5.1" | ||
sourcemap-codec "^1.4.8" | ||
|
||
rollup-plugin-copy@^3.4.0: | ||
version "3.4.0" | ||
resolved "https://registry.yarnpkg.com/rollup-plugin-copy/-/rollup-plugin-copy-3.4.0.tgz#f1228a3ffb66ffad8606e2f3fb7ff23141ed3286" | ||
integrity sha512-rGUmYYsYsceRJRqLVlE9FivJMxJ7X6jDlP79fmFkL8sJs7VVMSVyA2yfyL+PGyO/vJs4A87hwhgVfz61njI+uQ== | ||
dependencies: | ||
"@types/fs-extra" "^8.0.1" | ||
colorette "^1.1.0" | ||
fs-extra "^8.1.0" | ||
globby "10.0.1" | ||
is-plain-object "^3.0.0" | ||
|
||
rollup-plugin-node-resolve@^5.2.0: | ||
version "5.2.0" | ||
resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz#730f93d10ed202473b1fb54a5997a7db8c6d8523" | ||
|
@@ -2154,6 +2225,11 @@ type-fest@^0.8.1: | |
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" | ||
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== | ||
|
||
universalify@^0.1.0: | ||
version "0.1.2" | ||
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" | ||
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== | ||
|
||
uri-js@^4.2.2: | ||
version "4.4.1" | ||
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" | ||
|