Skip to content
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

feat: updated website with styling and more examples #88

Closed
wants to merge 1 commit into from

Conversation

novaotp
Copy link

@novaotp novaotp commented Oct 16, 2024

Closes #73

@novaotp novaotp changed the title feat: updated website with stylîng and more examples feat: updated website with styling and more examples Oct 16, 2024
@novaotp novaotp mentioned this pull request Oct 16, 2024
Copy link
Member

@Pomax Pomax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the changes in this PR, we probably want to define at least a partial build task, because the page itself shouldn't need to run client-side code just to "finish rendering itself".

There's also a bunch of general cleanup we can do wrt CSS, SVG, and markup, but this is a great first pass, thank you for helping!

draggable="false"
/>
</div>
<html lang="en">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please keep this two-space indented

<header id="navbar">
<a href="https://github.com/drag-drop-touch-js/dragdroptouch" target="_blank">
<svg
xmlns="http://www.w3.org/2000/svg"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When used in HTML5, SVG elements do not count as XML, and do not use namespaces.

stroke-linejoin="round"
class="icon icon-tabler icons-tabler-outline icon-tabler-brand-github"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this path does nothing =)

Comment on lines +32 to +36
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not use inline styling - when used as a regular HTML5 element any SVG element is subject to CSS just like every else (but require you to set the SVG-specific CSS properties like stroke or fill rather than color and background of course)

>
</div>
</div>
<div id="content">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to duplicate the entire nav, just use @media (...) on the CSS side to style things appropriately based on viewport dimensions.

Comment on lines +266 to +273
const importMetaErrorCode = document.querySelector(`#import-meta-error-code`);
importMetaErrorCode.innerHTML = await codeToHtml(
`Uncaught SyntaxError: import.meta may only appear in a module`,
{
lang: "html",
theme: "catppuccin-latte",
}
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as we write proper JS, this error does not need handling.

Comment on lines +253 to +264
/** Highlight the code with Shiki. */
const downloadPolyfillCode = document.querySelector(`#download-polyfill-code`);
downloadPolyfillCode.innerHTML = await codeToHtml(
`<script
src="drag-drop-touch.esm.min.js?autoload"
type="module"
></script>`,
{
lang: "javascript",
theme: "catppuccin-latte",
}
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're inlining SVG, let's also inline the syntax-highlighted code. That way, this code only needs to run once (at build time) rather than having to run as many times as there are people visiting this page.

Comment on lines +9 to +15
html,
body {
position: relative;
width: 100%;
height: 100dvh;
overflow: hidden;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not do this: this is a normal web page, not a single-page app. The polyfill should work for pages with scrollbars just fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, since CSS nesting has been part of the standard for a year now, and tooling like VS Code understand nesting just fine, let's not add a whole bunch of flat rules. Nest where we can, and if we need "component"-specific rules that need global declaration, we can @import those from a separate file (although I don't think that necessary here)

@@ -1,46 +1,579 @@
[draggable] {
user-select: none;
* {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we adding a * rule here? Just assign the font-family for the html,body rule, and the C in CSS will take care of the rest.


a {
color: black;
text-decoration: none;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not mess with accessibility: this is not an app, it's still a normal webpage, so links can stay default coloured and underlined.

@novaotp novaotp closed this by deleting the head repository Nov 10, 2024
@Pomax
Copy link
Member

Pomax commented Nov 10, 2024

Sorry to see you close this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refine the demo page
2 participants