-
Notifications
You must be signed in to change notification settings - Fork 28
Apply the approved preview design to the slide page #421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7035adf
Add an API to publish a slide from the preview
tomoasleep b61b686
Point Colors.surfaceVariant at the CSS variable Qiita defines
tomoasleep d3233b3
Show speaker notes under each slide in place of the page number
tomoasleep e16da7e
Drop the footer from the slide presentation mode
tomoasleep 71932b9
Split the slide toolbar into slideshow and publish buttons
tomoasleep 1d283d4
Let header buttons inherit the font so their sizes match
tomoasleep 50e2d28
Keep header button links from underlining on hover
tomoasleep File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,7 +1,12 @@ | ||
| import { css } from "@emotion/react"; | ||
| import { useState } from "react"; | ||
| import { Link, useNavigate } from "react-router"; | ||
| import { apiItemsUpdatePath, itemsShowPath } from "../../lib/qiita-cli-url"; | ||
| import { | ||
| apiItemsUpdatePath, | ||
| apiSlidesUpdatePath, | ||
| itemsShowPath, | ||
| slidesShowPath, | ||
| } from "../../lib/qiita-cli-url"; | ||
| import { breakpoint, pointerFine } from "../lib/mixins"; | ||
| import { Colors, Typography, Weight, getSpace } from "../lib/variables"; | ||
| import { useWindowSize } from "../lib/window-size"; | ||
|
|
@@ -115,17 +120,66 @@ export const Header = ({ | |
| }; | ||
|
|
||
| export const HeaderSlide = ({ | ||
| id, | ||
| basename, | ||
| isSlidePublishable, | ||
| isOlderThanRemote, | ||
| slidePath, | ||
| presentPath, | ||
| handleMobileOpen, | ||
| }: { | ||
| id: string; | ||
| basename: string | null; | ||
| isSlidePublishable: boolean; | ||
| isOlderThanRemote: boolean; | ||
| slidePath: string; | ||
| presentPath: string; | ||
| handleMobileOpen: () => void; | ||
| }) => { | ||
| const navigate = useNavigate(); | ||
| const [snackbarMessage, setSnackbarMessage] = | ||
| useState<null | SnackbarMessage>(null); | ||
| const { currentWidth } = useWindowSize(); | ||
| const mobileSize = currentWidth <= breakpoint.S; | ||
|
|
||
| const handlePublish = () => { | ||
| if (isOlderThanRemote) { | ||
| if ( | ||
| !window.confirm( | ||
| "このスライドはQiita上のスライドより古い可能性があります。上書きしますか?", | ||
| ) | ||
| ) { | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| fetch(apiSlidesUpdatePath(id), { | ||
| method: "POST", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| }, | ||
| body: JSON.stringify({ basename: basename }), | ||
| }) | ||
| .then((response) => response.json()) | ||
| .then((data) => { | ||
| if (!data.uuid) { | ||
| setSnackbarMessage({ | ||
| type: "error", | ||
| message: "投稿に失敗しました", | ||
| }); | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| setSnackbarMessage({ | ||
| type: "success", | ||
| message: "スライドが投稿されました", | ||
| }); | ||
|
|
||
| navigate(slidesShowPath(data.uuid)); | ||
| }); | ||
| }; | ||
|
|
||
| return ( | ||
| <header css={headerStyle}> | ||
| {mobileSize ? ( | ||
|
|
@@ -148,15 +202,32 @@ export const HeaderSlide = ({ | |
| <CopyButton text={slidePath} /> | ||
| </div> | ||
| )} | ||
| <Link | ||
| css={headerButtonStyle} | ||
| to={presentPath} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| > | ||
| {mobileSize ? "プレゼンモード" : "プレゼンテーションモードで開く"} | ||
| <MaterialSymbol>slideshow</MaterialSymbol> | ||
| </Link> | ||
| <div css={headerActionsStyle}> | ||
| <Link | ||
| aria-label={mobileSize ? "スライドショーを開始" : undefined} | ||
| css={[ | ||
| headerButtonStyle, | ||
| headerGrayButtonStyle, | ||
| mobileSize && headerIconButtonStyle, | ||
| ]} | ||
| to={presentPath} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| > | ||
| {!mobileSize && "スライドショーを開始"} | ||
| <MaterialSymbol>slideshow</MaterialSymbol> | ||
| </Link> | ||
| <button | ||
| aria-label={mobileSize ? "スライドを投稿する" : undefined} | ||
| css={[headerButtonStyle, mobileSize && headerIconButtonStyle]} | ||
| disabled={!isSlidePublishable} | ||
| onClick={handlePublish} | ||
| > | ||
| {!mobileSize && "スライドを投稿する"} | ||
| <MaterialSymbol>publish</MaterialSymbol> | ||
| </button> | ||
|
Comment on lines
+206
to
+228
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. このボタン2つのサイズが合ってなさそう
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| </div> | ||
| <Snackbar message={snackbarMessage} setMessage={setSnackbarMessage} /> | ||
| </header> | ||
| ); | ||
| }; | ||
|
|
@@ -220,6 +291,7 @@ const headerButtonStyle = css({ | |
| borderRadius: 8, | ||
| color: Colors.green80, | ||
| display: "flex", | ||
| font: "inherit", | ||
| fontWeight: Weight.bold, | ||
| gap: `0 ${getSpace(1 / 2)}px`, | ||
| padding: `${getSpace(1 / 2)}px ${getSpace(2)}px`, | ||
|
|
@@ -235,10 +307,30 @@ const headerButtonStyle = css({ | |
| ...pointerFine({ | ||
| "&:hover": { | ||
| backgroundColor: Colors.gray20, | ||
| textDecoration: "none", | ||
| }, | ||
| }), | ||
| }); | ||
|
|
||
| const headerActionsStyle = css({ | ||
| alignItems: "center", | ||
| display: "flex", | ||
| gap: getSpace(1), | ||
| }); | ||
|
|
||
| const headerGrayButtonStyle = css({ | ||
| borderColor: Colors.gray80, | ||
| color: Colors.gray80, | ||
| }); | ||
|
|
||
| const headerIconButtonStyle = css({ | ||
| boxSizing: "border-box", | ||
| height: 48, | ||
| justifyContent: "center", | ||
| padding: 0, | ||
| width: 48, | ||
| }); | ||
|
|
||
| const headerLogoWrapperStyle = css({ | ||
| display: "flex", | ||
| }); | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
headerButtonStyleのhover時に
textDecoration: "none",を追加したいです。There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
追加しました(50e2d28)。
hover 時に「スライドショーを開始」(
<a>)に下線が付いていたのが消えることを、Playwright で確認しています(text-decoration-lineがunderline→none)。Before / After のスクリーンショットは PR 本文の「ヘッダーのボタンリンクに hover で下線が付かないようにした」に貼りました。<button>のボタンは、もともと下線が付かないので変化はありません。