Skip to content

Commit

Permalink
Merge pull request #14 from Appbird/topic/#5-ruleClass-pageJump
Browse files Browse the repository at this point in the history
Topic/#5 rule class page jump
  • Loading branch information
Appbird authored Sep 2, 2021
2 parents cda8560 + bbed0e1 commit 3ee55aa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ts/client/view/parts/GameModeRuleView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class GameModeRuleView {
setHeader({ title, description,ruleName, iconCSS }: { title: string; ruleName:string; description?: string; iconCSS: string; }) {
this.headerSegment.innerHTML = "";
const header = new TitleCupsuled(appendElement(this.headerSegment, "div"));
header.refresh(title, ruleName, { iconCSS,chara:"u-smallerChara" });
header.refresh(title, ruleName, { iconCSS,chara:"u-smallerChara",id:ruleName.replace(/\s/g,"_") });
appendElement(this.headerSegment, "p", "u-smallerChara u-width90per").innerHTML = description || ""
}
setRule({ appliedClass }: { appliedClass: AppliedRuleClassResolved[]; }) {
Expand Down
3 changes: 2 additions & 1 deletion src/ts/client/view/parts/RuleIndexPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export class RuleIndexPart {
}
private generateRuleIndexHTML(ruleObj: RuleAttributeAndAppliedClassInfo, language: LanguageInApplication) {
return `<div class="__item">
<div><i class="${ruleObj.rule.iconCSS}"></i> ${ruleObj.rule.title}${(ruleObj.rule.note || 0) !== 0 ? ` <i class="u-redChara u-bolderChara">${choiceString(contents.annotated, language)}</i>` : ""}</div> <div class="__classItems">${this.generateClassDescriptionInRuleIndex(ruleObj.appliedClass, language)}</div>
<div><a class="u-bolderChara u-underline" href="#${ruleObj.rule.ruleName.replace(/\s/g,"_")}"><i class="${ruleObj.rule.iconCSS}"></i> ${ruleObj.rule.title}</a>
${(ruleObj.rule.note || 0) !== 0 ? ` <i class="u-redChara u-bolderChara">${choiceString(contents.annotated, language)}</i>` : ""}</div> <div class="__classItems">${this.generateClassDescriptionInRuleIndex(ruleObj.appliedClass, language)}</div>
</div>`;
}
private generateClassDescriptionInRuleIndex(appliedClass: AppliedRuleClassResolved[], language: LanguageInApplication) {
Expand Down
8 changes: 5 additions & 3 deletions src/ts/client/view/parts/TitleCupsuled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ export class TitleCupsuled implements IView{
chara = "",
subChara = "",
hr = "u-thin",
iconCSS
iconCSS,
id = ""
}:{
chara?:"u-biggerChara"|"u-smallerChara"|"",
subChara?:"u-biggerChara"|"u-smallerChara"|"",
hr?:"u-thin"|"u-bold"
underline?:boolean,
iconCSS?:string
iconCSS?:string,
id?:string
} = {}){
this.container.innerHTML = "";
const title = this.container.appendChild(elementWithoutEscaping`
<div class="c-title u-margin05em">
<div class="c-title__main ${chara}">${(iconCSS) ? `<i class="${iconCSS}"></i> ` : "" }${main}</div>
<div class="c-title__main ${chara}" id="${id}">${(iconCSS) ? `<i class="${iconCSS}"></i> ` : "" }${main}</div>
</div>
`);
if (sub !== undefined) title.appendChild(elementWithoutEscaping`<div class="c-title__sub ${subChara}">${sub}</div>`)
Expand Down

0 comments on commit 3ee55aa

Please sign in to comment.