-
Notifications
You must be signed in to change notification settings - Fork 580
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
teacher tool: add address bar #9839
Conversation
className?: string; | ||
} | ||
|
||
export const AddressBar: React.FC<IProps> = ({ className }) => { |
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.
Is AddressBar the right name for this? I know that SearchBar isn't right, either, but when I read address bar, it took me a minute to understand that this is the component where the user submits the share link.
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.
I chose AddressBar because:
- it's modeled closely after a browser's address bar.
- the most common input will be a pasted URL, like an address bar.
I am open to alternatives!
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.
ShareLinkInput would be the most descriptive, probably. But I'm fine with AddressBar.
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.
Renamed!
} | ||
|
||
export const AddressBar: React.FC<IProps> = ({ className }) => { | ||
const { state: teacherTool } = useContext(AppStateContext); |
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.
Is there a reason we wouldn't just name this projectMetadata
?
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.
I believe this is a way of extracting projectMetadata
from the teacherTool
object.
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.
I don't think I'm following. Naming this projectMetadata would mean accessing the actual project metadata like projectMetadata.projectMetadata
.
Line 17 is where I extract projectMetadata
to a local var.
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.
Oh, yeah, I was confused because the projectMetadata
variable was accessed similar to how this is, and I thought we could just rename the state, but I realize now that it is a similar accessor, but we need both of these. I know I did not explain that well, but long story short, I understand now and appreciate the clarification!
export const ProjectWorkspace: React.FC<IProps> = () => { | ||
return ( | ||
<div className={classes(css, "panel", "h-full", "w-full", "flex", "flex-col")}> | ||
<Toolbar toolbarClass={css["grow-1"]}> |
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.
I know this is a placeholder, but I was wondering if the project view toggle we're going to fill in here is something we'll be able to do in v1? Is the toggle just so a teacher can look at a student's project in JavaScript? Would it be clear that they can't validate projects in JavaScript?
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.
They actually can still validate a project even after switching to JS. It'll still validate the blocks, but it should all still work. It won't work well if a project was made in Javascript instead of blocks, but I think that's a different scenario.
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.
Yeah, I'm worried the toggle will give the impression that we support evaluating JavaScript-only projects, but this is an assumption. I imagine a scenario where a teacher sees the toggle, thinks "Oh, I can validate student projects in JavaScript, too", uploads a JavaScript-only project and then the evaluation doesn't work. But, if a teacher uploads a JavaScript project, that's something that we can know, right? And just error and tell the user "sorry, we cannot evaluate JavaScript-made projects at this time".
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.
I wouldn't worry about it too much for v1, but yes I think we can check the preferred editor and error if needed.
I think there is value in having the toggle regardless, as one teacher did mention they like to switch to JS to search for things in the code, rather than scrolling through blocks, so there's a known use-case there.
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.
Good point Sarah. I'd like to leave this as an open design question for now. I'll add it to the work board to track.
} | ||
|
||
export const SplitPane: React.FC<IProps> = ({ className, split, children }) => { | ||
export const SplitPane: React.FC<IProps> = ({ className, split, children, leftPaneClass, rightPaneClass }) => { |
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.
What will something like the left or right pane class look like?
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.
The purpose is to enable the parent to inject css into the div that wraps the panel content. I may end up removing it. This can be accomplished without adding a prop.
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.
Removed!
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.
Is it valuable to create a styling module for something that's empty right now?
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.
It won't be empty for long.
* import this file directly into components. Instead, import into the | ||
* component's module.scss file so that it will be scoped to that module. | ||
* | ||
* Classes in this file are composable, modeled after [Tailwind CSS](https://tailwindcss.com) |
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.
I know we chatted about this as we were getting started and decided not to use tailwind, so I just wanted to ask the benefit of creating a system like this ourselves? I know this can make things really clean, so do we want to make an in-house solution like tailwind so we can also use Sass modules? Do we want to use both systems because it's nice to have these pre-programmed standards while also having custom styling that is a bit easier to read?
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.
I love tailwind's composable classes specifically for controlling flex layout. I was building my own set and it was starting to look a lot like tailwind, so I just copied this tiny subset from tailwind. It doesn't imply we should adopt tailwind wholesale.
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.
I'm a little skeptical about this re-inventing tailwind from scratch setup, personally. We're getting into a weird hybrid state where some components are styled with more typical css classes and some use these composable ones, and I think it's likely to get messy and unclear which approach we should use when...
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.
I don't think we should adopt tailwind. It has a lot of functionality I think we wouldn't want to make available to our codebase, like color palettes and media breakpoints. We already have these. I'd rather take inspiration from it where it makes sense, in limited ways.
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.
Hmm, but even with the classes here, what's the rule of thumb for when you should make a specific css class for a component vs grouping together a bunch of these?
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.
For example, I'm not sure why the ProjectWorkspace root would use "panel", "h-full", "w-full", "flex", "flex-col" instead of having its own class.
I actually quite like tailwind myself, so I understand the desire to have that functionality, but I'm concerned about what this in-between approach will end up looking like
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.
I'd say rule of thumb is: don't use these classes unless it seems more natural to do so. They can be useful to inject additional css into a react-common component by className prop. I may end up not using them where I am now.
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.
I guess I don't see what defined "where it makes sense"
where it makes sense = where functionality wouldn't conflict with existing systems. color theming and media breakpoints being two examples where conflict would occur.
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.
For example, I'm not sure why the ProjectWorkspace root would use "panel", "h-full", "w-full", "flex", "flex-col" instead of having its own class.
I actually quite like tailwind myself, so I understand the desire to have that functionality, but I'm concerned about what this in-between approach will end up looking like
That wasn't the best use of these classes, I admit. That code evolved over time, and should have evolved once more to move flex functionality into the panel class.
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.
If these classes are a sticking point, I can remove them. They aren't colliding with anything, but they're also just a convenience layer.
} | ||
|
||
/// Visibility | ||
.hidden { |
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.
Does this already exist in the react-common styles? I think it might.
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.
Probably. I ended up not using them anyway. Removed.
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.
Still a little skeptical about the tailwind-like classes, but we don't need to block on it.
I'll remove them! |
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.
LGTM!
Implements the address bar control.
TODO (in a future PR):