Skip to content

Commit

Permalink
Merge pull request #119 from UofGAnalytics/using-git-features
Browse files Browse the repository at this point in the history
add noHexagons flag to cli options
  • Loading branch information
dmca-glasgow committed Jun 27, 2022
2 parents 69da172 + fe0b52e commit f6d070f
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 20 deletions.
5 changes: 5 additions & 0 deletions compiler/src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ const { argv } = yargs(process.argv.slice(2))
type: 'boolean',
description: 'No Tex Svg',
})
.option('noHexagons', {
type: 'boolean',
description: 'No cover hexagons',
})
.option('spelling', {
type: 'boolean',
description: 'Check spelling',
Expand Down Expand Up @@ -88,6 +92,7 @@ const options: Options = {
noEmbedAssetUrl: argv.noEmbedAssetUrl,
noCache: argv.noCache,
noTexSvg: argv.noTexSvg,
noHexagons: argv.noHexagons,
spelling: argv.spelling,
pythonBin: argv.pythonBin,
force: argv.force,
Expand Down
1 change: 1 addition & 0 deletions compiler/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type Options = {
noEmbedAssetUrl?: boolean;
noCache?: boolean;
noTexSvg?: boolean;
noHexagons?: boolean;
week?: number;
watch?: boolean;
shouldFail?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/html/pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function pdfWrapper(unit: Unit, ctx: Context) {
return async (tree: Node) => {
const main = await createMain(
unit.titles,
ctx.course,
ctx,
(tree as Parent).children
);
const iconDefs = createDefs();
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/html/wrapper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function htmlWrapper(unit: Unit, mdast: Parent, ctx: Context) {
return async (tree: Parent) => {
const hamburgerIcon = createSvg('hamburger-icon');
const sidebar = await createSidebar(mdast);
const main = await createMain(unit.titles, ctx.course, tree.children);
const main = await createMain(unit.titles, ctx, tree.children);
const iconDefs = createDefs();
return {
type: 'root',
Expand Down
15 changes: 13 additions & 2 deletions compiler/src/html/wrapper/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,25 @@ import { visit } from 'unist-util-visit';

import dagLogoSvg from '../../../assets/dag-logo.svg';
import coverSvg from '../../../assets/hexagons.svg';
import { Context } from '../../context';
import { Course, UnitTitles } from '../../course/types';
import { getAssetHast } from '../../utils/get-asset-hast';

export async function createMain(
titles: UnitTitles,
course: Course,
ctx: Context,
content: Node[]
) {
const children = [];

if (ctx.options.noHexagons) {
children.push(createH1(titles));
} else {
children.push(createCover(titles, ctx.course));
}

children.push(...content);

return {
type: 'element',
tagName: 'main',
Expand All @@ -21,7 +32,7 @@ export async function createMain(
properties: {
className: 'wrapper',
},
children: [createCover(titles, course), ...content],
children,
},
],
};
Expand Down
31 changes: 15 additions & 16 deletions template/src/styles/cover.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
.cover {
h1 {
font-size: 3.3em;
margin: 0.5em 0 1.45em;
}
h1 {
font-size: 3.3em;
margin: 0.5em 0 1.45em;
}

h1 span {
display: block;
font-size: 0.4em;
opacity: 0.4;
margin-top: 1em;
}
h1 span {
display: block;
font-size: 0.4em;
opacity: 0.4;
margin-top: 1em;
}

.cover {
.logos {
display: flex;
flex-direction: row-reverse;
Expand Down Expand Up @@ -54,12 +54,11 @@
}

@media (max-width: 1000px) {
h1 {
font-size: 3em;
margin: 2em 0 1em;
}
.cover {
h1 {
font-size: 3em;
margin: 2em 0 1em;
}

.logos {
display: block;
}
Expand Down

0 comments on commit f6d070f

Please sign in to comment.