Skip to content

Commit

Permalink
Merge branch 'feature-fonts'
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzmisa committed Sep 16, 2022
2 parents 2cf5545 + 1e9da3c commit 7a4a0fb
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 37 deletions.
2 changes: 0 additions & 2 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
justify-content: center;
text-align: center;

/* コンテンツのフォント */
font-family: "Lato", sans-serif;
font-size: 60px;
color: white;

Expand Down
53 changes: 42 additions & 11 deletions en/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
<!-- Bulma -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.4/css/bulma.min.css" rel="stylesheet">
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Oswald" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=BIZ+UDPGothic&family=Lato&family=Oswald&family=Train+One&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css"
integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
Expand Down Expand Up @@ -168,7 +169,7 @@ <h2 class="subtitle">Generator of simple featured images</h2>
<template v-for="webgradient in webgradients">
<div class="column is-4"><a class="box"
v-on:click="selectGradient(webgradient); gradientsModalFlg=false"
v-bind:style='{ background: "linear-gradient(" + webgradient + ")" }'><br><br><br><br><br></a></div>
v-bind:style="{ background: 'linear-gradient(' + webgradient + ')' }"><br><br><br><br><br></a></div>
</template>
</div>
</section>
Expand Down Expand Up @@ -207,20 +208,50 @@ <h2 class="subtitle">Generator of simple featured images</h2>
<div class="field">
<label class="label">Image size</label>
<div class="is-flex">
<div class="field">
<p class="control">
<input class="input" type="text" v-model="width">
</p>
</div>
<p class="control">
<input class="input" type="text" v-model="width">
</p>
<div class="mx-3 is-size-5">x</div>
<div class="field">
<p class="control">
<input class="input" type="text" v-model="height">
</p>
</div>
</div>
<div class="field">
<label class="label">Font</label>
<p class="control">
<div class="field has-addons">
<p class="control is-expanded">
<input class="input" type="text" v-bind:value="font.name" v-bind:style="{ fontFamily: font.fontFamily }" readonly>
</p>
<p class="control">
<input class="input" type="text" v-model="height">
<a class="button is-link" v-on:click='fontsModalFlg=true'>Pick</a>
</p>
</div>
</p>
</div>
<!-- fontsModal ... -->
<div class="modal" v-bind:class='{"is-active":fontsModalFlg}'>
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">Pick a font</p>
<button class="delete" aria-label="close" v-on:click='fontsModalFlg=false'></button>
</header>
<section class="modal-card-body">
<div class="columns is-multiline has-text-centered">
<template v-for="f in fonts">
<div class="column is-4">
<a class="box" v-text="f.name" v-bind:style="{ fontFamily: f.fontFamily }" v-on:click="selectFont(f); fontsModalFlg=false"
><br><br><br><br><br></a></div>
</template>
</div>
</section>
<footer class="modal-card-foot">
</footer>
</div>
</div>
</div>
<!-- ...fontsModal -->
</details>
</div>
</div>
Expand Down
53 changes: 42 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
<!-- Bulma -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.4/css/bulma.min.css" rel="stylesheet">
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Oswald" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=BIZ+UDPGothic&family=Lato&family=Oswald&family=Train+One&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css"
integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
Expand Down Expand Up @@ -168,7 +169,7 @@ <h2 class="subtitle">アイキャッチ画像が簡単に作れるジェネレ
<template v-for="webgradient in webgradients">
<div class="column is-4"><a class="box"
v-on:click="selectGradient(webgradient); gradientsModalFlg=false"
v-bind:style='{ background: "linear-gradient(" + webgradient + ")" }'><br><br><br><br><br></a></div>
v-bind:style="{ background: 'linear-gradient(' + webgradient + ')' }"><br><br><br><br><br></a></div>
</template>
</div>
</section>
Expand Down Expand Up @@ -208,20 +209,50 @@ <h2 class="subtitle">アイキャッチ画像が簡単に作れるジェネレ
<div class="field">
<label class="label">画像サイズ</label>
<div class="is-flex">
<div class="field">
<p class="control">
<input class="input" type="text" v-model="width">
</p>
</div>
<p class="control">
<input class="input" type="text" v-model="width">
</p>
<div class="mx-3 is-size-5">x</div>
<div class="field">
<p class="control">
<input class="input" type="text" v-model="height">
</p>
</div>
</div>
<div class="field">
<label class="label">フォント</label>
<p class="control">
<div class="field has-addons">
<p class="control is-expanded">
<input class="input" type="text" v-bind:value="font.name" v-bind:style="{ fontFamily: font.fontFamily }" readonly>
</p>
<p class="control">
<input class="input" type="text" v-model="height">
<a class="button is-link" v-on:click='fontsModalFlg=true'>選択</a>
</p>
</div>
</p>
</div>
<!-- fontsModal ... -->
<div class="modal" v-bind:class='{"is-active":fontsModalFlg}'>
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">フォント選択</p>
<button class="delete" aria-label="close" v-on:click='fontsModalFlg=false'></button>
</header>
<section class="modal-card-body">
<div class="columns is-multiline has-text-centered">
<template v-for="f in fonts">
<div class="column is-4">
<a class="box" v-text="f.name" v-bind:style="{ fontFamily: f.fontFamily }" v-on:click="selectFont(f); fontsModalFlg=false"
><br><br><br><br><br></a></div>
</template>
</div>
</section>
<footer class="modal-card-foot">
</footer>
</div>
</div>
</div>
<!-- ...fontsModal -->
</details>
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions js/fonts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default [
{ name: "BIZ UDPGothic", fontFamily: '"BIZ UDPGothic", sans-serif' },
{ name: "Lato", fontFamily: '"Lato", sans-serif' },
{ name: "Oswald", fontFamily: '"Oswald", sans-serif' },
{ name: "Train One", fontFamily: '"Train One", cursive' },
];
36 changes: 23 additions & 13 deletions js/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import icons from "./icons.js";
import webgradients from "./webgradients.js";
import fonts from "./fonts.js";

const app = new Vue({
el: "#app",
data: {
iconsModalFlg: false,
gradientsModalFlg: false,
fontsModalFlg: false,
title: "Eye Catch Maker",
title_en: "Featured image maker",
icon: "fa fa-eye",
color: "to left top, #05FBFF, #1E00FF",
width: 780,
height: 520,
font: fonts[1],
keyword: "",
isDownloading: false,
zoomPercentage: 100,
Expand All @@ -25,6 +28,12 @@ const app = new Vue({
}
},
computed: {
fonts: function () {
return fonts;
},
webgradients: function () {
return webgradients;
},
sampleItems: function () {
return [
{
Expand All @@ -47,8 +56,16 @@ const app = new Vue({
},
];
},
webgradients: function () {
return webgradients;
searchedIcons: function () {
const options = {
threshold: 0.3,
keys: ["name", "term"],
};
const fuse = new Fuse(icons, options);
let result;
if (!this.keyword) result = icons;
else result = fuse.search(this.keyword);
return result;
},
cssForPreview: function () {
return {
Expand All @@ -62,6 +79,7 @@ const app = new Vue({
width: this.width + "px",
height: this.height + "px",
background: "linear-gradient(" + this.color + ")",
fontFamily: this.font.fontFamily,
};
},
cssForPhotoArea: function () {
Expand All @@ -71,17 +89,6 @@ const app = new Vue({
backgroundImage: "url(" + this.imageData + ")",
};
},
searchedIcons: function () {
const options = {
threshold: 0.3,
keys: ["name", "term"],
};
const fuse = new Fuse(icons, options);
let result;
if (!this.keyword) result = icons;
else result = fuse.search(this.keyword);
return result;
},
},
methods: {
selectImage: function (e) {
Expand Down Expand Up @@ -129,5 +136,8 @@ const app = new Vue({
selectGradient: function (selectedGradient) {
this.color = selectedGradient;
},
selectFont: function (selectedFont) {
this.font = selectedFont;
},
},
});

0 comments on commit 7a4a0fb

Please sign in to comment.