@khanacademy/perseus 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Core Perseus API (includes renderers and widgets)",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "2.0.0",
6
+ "version": "2.0.1",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -55,7 +55,12 @@
55
55
 
56
56
  @paragraphSpacing: 32px;
57
57
  .perseus-widget-container {
58
- .legacy-typography;
58
+ // HACK(matthewc): to get around this fixed font-size
59
+ // since we want the definition widget to match
60
+ // surrounding text
61
+ &:not(.perseus-widget__definition) {
62
+ .legacy-typography;
63
+ }
59
64
 
60
65
  &.widget-float-left,
61
66
  &.widget-float-right {
@@ -68,6 +68,10 @@ class WidgetContainer extends React.Component<Props, State> {
68
68
  "perseus-widget-container": true,
69
69
  "widget-highlight": this.props.shouldHighlight,
70
70
  "widget-nohighlight": !this.props.shouldHighlight,
71
+ // HACK(matthewc): perseus-widget-container is setting a font-size
72
+ // but we want the definition prompt to match the surrounding font
73
+ // I'm sorry, but there's a time crunch
74
+ "perseus-widget__definition": this.props.type === "definition",
71
75
  });
72
76
 
73
77
  const type = this.props.type;
@@ -2,6 +2,7 @@
2
2
  import * as React from "react";
3
3
 
4
4
  import {RendererWithDebugUI} from "../../../../../testing/renderer-with-debug-ui.jsx";
5
+ import ArticleRenderer from "../../article-renderer.jsx";
5
6
 
6
7
  export default {
7
8
  title: "Perseus/Widgets/Definition",
@@ -71,12 +72,37 @@ const question2 = {
71
72
  },
72
73
  };
73
74
 
75
+ const article = {
76
+ content:
77
+ "###Backstory\n\nDuring World War II, in August of 1943, the [[☃ definition 1]] launched a massive bombing campaign on Milan and its outskirts. The explosions and the ensuing fires killed over 700 people and destroyed many of the city’s most important buildings and monuments, including a significant portion of Santa Maria delle Grazie. Miraculously, the wall with the painting survived, probably because it had been shored up with sandbags and mattresses, but the roof of the refectory was blown off and the other walls were decimated. The _Last Supper_ remained exposed to the elements, covered only with a tarp, for several months, until the refectory (the dining room of the monastery where the _Last Supper_ was painted), was rebuilt and a team of restorers began working to preserve and restore the painting.",
78
+ images: {},
79
+ widgets: {
80
+ "definition 1": {
81
+ alignment: "default",
82
+ graded: true,
83
+ options: {
84
+ definition:
85
+ "The Allies, led by the United Kingdom, the United States, and the Soviet Union, were the group of countries who opposed the Axis powers (Germany, Japan, and Italy) during World War II.",
86
+ static: false,
87
+ togglePrompt: "Allies",
88
+ },
89
+ static: false,
90
+ type: "definition",
91
+ version: {major: 0, minor: 0},
92
+ },
93
+ },
94
+ };
95
+
74
96
  type StoryArgs = {||};
75
97
 
76
98
  export const Question1 = (args: StoryArgs): React.Node => {
77
99
  return <RendererWithDebugUI question={question1} />;
78
100
  };
79
101
 
80
- export const MultipleDefintions = (args: StoryArgs): React.Node => {
102
+ export const MultipleDefinitions = (args: StoryArgs): React.Node => {
81
103
  return <RendererWithDebugUI question={question2} />;
82
104
  };
105
+
106
+ export const ArticleDefintion = (args: StoryArgs): React.Node => {
107
+ return <ArticleRenderer json={article} useNewStyles />;
108
+ };
@@ -27,7 +27,7 @@ exports[`Definition widget should have a default snapshot: first render 1`] = `
27
27
  >
28
28
  The Governor and Council of the Massachusetts had much conference many days; and at last . . . . concluded a peace and friendship with
29
29
  <div
30
- class="perseus-widget-container widget-nohighlight widget-inline"
30
+ class="perseus-widget-container widget-nohighlight perseus-widget__definition widget-inline"
31
31
  >
32
32
  <button
33
33
  aria-controls="uid-popover-0-wb-id"
@@ -79,7 +79,7 @@ exports[`Definition widget should have an open state snapshot: open state 1`] =
79
79
  >
80
80
  The Governor and Council of the Massachusetts had much conference many days; and at last . . . . concluded a peace and friendship with
81
81
  <div
82
- class="perseus-widget-container widget-nohighlight widget-inline"
82
+ class="perseus-widget-container widget-nohighlight perseus-widget__definition widget-inline"
83
83
  >
84
84
  <button
85
85
  aria-controls="uid-popover-1-wb-id"