forked from RCOSDP/GakuNinLMS-LTI-MC
-
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.
Merge branch 'master' of github.com:npocccties/ChibiCHiLO into feat-i…
…mport-books
- Loading branch information
Showing
82 changed files
with
1,364 additions
and
937 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
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,11 @@ | ||
export default { title: "atoms/DescriptionList" }; | ||
|
||
import DescriptionList from "./DescriptionList"; | ||
|
||
const value = [...Array(10)].fill({ key: "key", value: "value" }); | ||
|
||
export const Default = () => <DescriptionList value={value} />; | ||
|
||
export const Inline = () => <DescriptionList inline value={value} />; | ||
|
||
export const Nowrap = () => <DescriptionList nowrap value={value} />; |
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,84 @@ | ||
import clsx from "clsx"; | ||
import { makeStyles, createStyles } from "@material-ui/core/styles"; | ||
import type { Theme } from "@material-ui/core/styles"; | ||
import grey from "@material-ui/core/colors/grey"; | ||
|
||
type StyleProps = { | ||
color: string; | ||
fontSize: string; | ||
}; | ||
|
||
const useStyles = makeStyles((theme: Theme) => | ||
createStyles({ | ||
root: { | ||
margin: 0, | ||
color: ({ color }: StyleProps) => color, | ||
fontSize: ({ fontSize }: StyleProps) => fontSize, | ||
lineHeight: 1.25, | ||
"& > $item:not(:last-child)": { | ||
marginBottom: theme.spacing(0.5), | ||
}, | ||
"&$inline > $item, &$nowrap > $item": { | ||
display: "inline-flex", | ||
}, | ||
"&$inline > $item:not(:last-child), &$nowrap > $item:not(:last-child)": { | ||
marginRight: theme.spacing(1.25), | ||
}, | ||
"&$nowrap": { | ||
overflow: "hidden", | ||
textOverflow: "ellipsis", | ||
whiteSpace: "nowrap", | ||
}, | ||
}, | ||
item: { | ||
display: "flex", | ||
"& > dt::after": { | ||
content: "':'", | ||
marginRight: theme.spacing(0.25), | ||
}, | ||
"& > dd": { | ||
margin: 0, | ||
}, | ||
}, | ||
inline: {}, | ||
nowrap: {}, | ||
}) | ||
); | ||
|
||
type Props = { | ||
className?: string; | ||
color?: string; | ||
fontSize?: string; | ||
inline?: boolean; | ||
nowrap?: boolean; | ||
value: Array<{ key: string; value: string }>; | ||
}; | ||
|
||
export default function DescriptionList({ | ||
className, | ||
color = grey[700], | ||
fontSize = "0.75rem", | ||
inline = false, | ||
nowrap = false, | ||
value, | ||
}: Props) { | ||
const classes = useStyles({ color, fontSize }); | ||
|
||
return ( | ||
<dl | ||
className={clsx( | ||
className, | ||
classes.root, | ||
{ [classes.inline]: inline }, | ||
{ [classes.nowrap]: nowrap } | ||
)} | ||
> | ||
{value.map(({ key, value }, index) => ( | ||
<div key={index} className={classes.item}> | ||
<dt>{key}</dt> | ||
<dd>{value}</dd> | ||
</div> | ||
))} | ||
</dl> | ||
); | ||
} |
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,7 @@ | ||
export default { title: "atoms/EditButton" }; | ||
|
||
import EditButton from "./EditButton"; | ||
|
||
export const Book = () => <EditButton variant="book" />; | ||
|
||
export const Topic = () => <EditButton variant="topic" />; |
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,24 @@ | ||
import EditOutlinedIcon from "@material-ui/icons/EditOutlined"; | ||
import IconButton from "$atoms/IconButton"; | ||
|
||
type Props = Omit<Parameters<typeof IconButton>[0], "tooltipProps"> & { | ||
variant: "book" | "topic"; | ||
}; | ||
|
||
const label = { | ||
book: "ブック", | ||
topic: "トピック", | ||
} as const; | ||
|
||
export default function EditButton({ variant, ...other }: Props) { | ||
return ( | ||
<IconButton | ||
tooltipProps={{ title: `${label[variant]}を編集` }} | ||
color="primary" | ||
size="small" | ||
{...other} | ||
> | ||
<EditOutlinedIcon /> | ||
</IconButton> | ||
); | ||
} |
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,12 @@ | ||
export default { title: "atoms/IconButton" }; | ||
|
||
import CloseIcon from "@material-ui/icons/Close"; | ||
import IconButton from "./IconButton"; | ||
|
||
export const Default = () => { | ||
return ( | ||
<IconButton tooltipProps={{ title: "閉じる" }}> | ||
<CloseIcon /> | ||
</IconButton> | ||
); | ||
}; |
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,15 @@ | ||
import MuiIconButton from "@material-ui/core/IconButton"; | ||
import Tooltip from "@material-ui/core/Tooltip"; | ||
|
||
type Props = Parameters<typeof MuiIconButton>[0] & { | ||
tooltipProps: Omit<Parameters<typeof Tooltip>[0], "children">; | ||
}; | ||
|
||
export default function IconButton(props: Props) { | ||
const { tooltipProps, ...others } = props; | ||
return ( | ||
<Tooltip {...tooltipProps}> | ||
<MuiIconButton {...others} /> | ||
</Tooltip> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export default { title: "atoms/Markdown" }; | ||
|
||
import Markdown from "./Markdown"; | ||
import outdent from "outdent"; | ||
|
||
export const Default = () => ( | ||
<Markdown> | ||
{outdent` | ||
# h1 | ||
## h2 | ||
### h3 | ||
#### h4 | ||
###### h5 | ||
###### h6 | ||
paragraph | ||
paragraph | ||
`} | ||
</Markdown> | ||
); |
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,24 @@ | ||
import ReactMarkdown from "react-markdown"; | ||
import gfm from "remark-gfm"; | ||
import breaks from "remark-breaks"; | ||
import Link from "@material-ui/core/Link"; | ||
import type { LinkProps } from "@material-ui/core/Link"; | ||
|
||
function MarkdownLink<Element extends React.ElementType>( | ||
props: LinkProps<Element> | ||
) { | ||
return <Link target="_blank" rel="noreferrer" {...props} />; | ||
} | ||
|
||
type Props = Pick<Parameters<typeof ReactMarkdown>[0], "children">; | ||
|
||
export default function Markdown({ children }: Props) { | ||
const components = { | ||
a: MarkdownLink, | ||
}; | ||
return ( | ||
<ReactMarkdown remarkPlugins={[gfm, breaks]} components={components}> | ||
{children} | ||
</ReactMarkdown> | ||
); | ||
} |
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,7 @@ | ||
export default { title: "atoms/PreviewButton" }; | ||
|
||
import PreviewButton from "./PreviewButton"; | ||
|
||
export const Book = () => <PreviewButton variant="book" />; | ||
|
||
export const Topic = () => <PreviewButton variant="topic" />; |
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,24 @@ | ||
import VisibilityOutlinedIcon from "@material-ui/icons/VisibilityOutlined"; | ||
import IconButton from "$atoms/IconButton"; | ||
|
||
type Props = Omit<Parameters<typeof IconButton>[0], "tooltipProps"> & { | ||
variant: "book" | "topic"; | ||
}; | ||
|
||
const label = { | ||
book: "ブック", | ||
topic: "トピック", | ||
} as const; | ||
|
||
export default function PreviewButton({ variant, ...other }: Props) { | ||
return ( | ||
<IconButton | ||
tooltipProps={{ title: `${label[variant]}をプレビュー` }} | ||
size="small" | ||
color="primary" | ||
{...other} | ||
> | ||
<VisibilityOutlinedIcon /> | ||
</IconButton> | ||
); | ||
} |
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,7 @@ | ||
export default { title: "atoms/RemoveButton" }; | ||
|
||
import RemoveButton from "./RemoveButton"; | ||
|
||
export const Topic = () => <RemoveButton variant="topic" />; | ||
|
||
export const Section = () => <RemoveButton variant="section" />; |
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,24 @@ | ||
import RemoveIcon from "@material-ui/icons/Remove"; | ||
import IconButton from "$atoms/IconButton"; | ||
|
||
type Props = Omit<Parameters<typeof IconButton>[0], "tooltipProps"> & { | ||
variant: "topic" | "section"; | ||
}; | ||
|
||
const label = { | ||
topic: "トピック", | ||
section: "セクション", | ||
} as const; | ||
|
||
export default function RemoveButton({ variant, ...other }: Props) { | ||
return ( | ||
<IconButton | ||
color="primary" | ||
size="small" | ||
{...other} | ||
tooltipProps={{ title: `この${label[variant]}を取り除く` }} | ||
> | ||
<RemoveIcon /> | ||
</IconButton> | ||
); | ||
} |
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
Oops, something went wrong.