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

chore: optimize devsite's toolbox css config and localized names injection #2312

Merged
merged 6 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions examples/devsite-landing-demo/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,9 @@ function init() {
}

// Inject localized category names.
toolboxJson['contents'][0].name = getMsg('Logic');
toolboxJson['contents'][1].name = getMsg('Loops');
toolboxJson['contents'][2].name = getMsg('Math');
toolboxJson['contents'][3].name = getMsg('Text');
toolboxJson['contents'][4].name = getMsg('Lists');
// Separator.
toolboxJson['contents'][6].name = getMsg('Variables');
toolboxJson['contents'][7].name = getMsg('Procedures');
toolboxJson['contents'].forEach(function (part) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks I think this is a lot better than before!

part.name = getMsg(part.name);
});

// Inject default variable name.
// https://github.com/google/blockly/issues/5238
Expand Down Expand Up @@ -138,11 +133,6 @@ function init() {
colourSecondary: '#B2DFDB',
colorTertiary: '#009688',
},
colour_blocks: {
colourPrimary: '#FFCDD2',
colourSecondary: '#FFEBEE',
colorTertiary: '#EF9A9A',
},
variable_blocks: {
colourPrimary: '#EF9A9A',
colourSecondary: '#FFEBEE',
Expand Down
14 changes: 7 additions & 7 deletions examples/devsite-landing-demo/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,31 +75,31 @@ option {
font-family: var(--font-family) !important;
}

#blockly-0 {
.blocklyTreeRowLogic {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks great =)

border-left: 15px solid #d1c4e9 !important;
}

#blockly-1 {
.blocklyTreeRowLoops {
border-left: 15px solid #a5d6a7 !important;
}

#blockly-2 {
.blocklyTreeRowMath {
border-left: 15px solid #4285f4 !important;
}

#blockly-3 {
.blocklyTreeRowText {
border-left: 15px solid #ffca28 !important;
}

#blockly-4 {
.blocklyTreeRowLists {
border-left: 15px solid #4db6ac !important;
}

#blockly-6 {
.blocklyTreeRowVariables {
border-left: 15px solid #ef9a9a !important;
}

#blockly-7 {
.blocklyTreeRowProcedures {
border-left: 15px solid #d7ccc8 !important;
}

Expand Down
32 changes: 30 additions & 2 deletions examples/devsite-landing-demo/toolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ let toolboxJson = {
{
// Logic Category
kind: 'CATEGORY',
name: 'Logic',
colour: 262,
cssConfig: {
row: 'blocklyTreeRow blocklyTreeRowLogic',
},
contents: [
{
kind: 'BLOCK',
Expand Down Expand Up @@ -47,7 +51,11 @@ let toolboxJson = {
{
// Loops Category
kind: 'CATEGORY',
name: 'Loops',
colour: 122,
cssConfig: {
row: 'blocklyTreeRow blocklyTreeRowLoops',
},
contents: [
{
kind: 'BLOCK',
Expand Down Expand Up @@ -103,7 +111,11 @@ let toolboxJson = {
{
// Math Category
kind: 'CATEGORY',
name: 'Math',
colour: 206,
cssConfig: {
row: 'blocklyTreeRow blocklyTreeRowMath',
},
contents: [
{
kind: 'BLOCK',
Expand Down Expand Up @@ -272,7 +284,11 @@ let toolboxJson = {
{
// Text Category
kind: 'CATEGORY',
name: 'Text',
colour: 46,
cssConfig: {
row: 'blocklyTreeRow blocklyTreeRowText',
},
contents: [
{
kind: 'BLOCK',
Expand Down Expand Up @@ -478,7 +494,11 @@ let toolboxJson = {
{
// Lists Category
kind: 'CATEGORY',
name: 'Lists',
colour: 172,
cssConfig: {
row: 'blocklyTreeRow blocklyTreeRowLists',
},
contents: [
{
kind: 'BLOCK',
Expand Down Expand Up @@ -650,17 +670,25 @@ let toolboxJson = {
},

{
// Variable Category
// Variables Category
kind: 'CATEGORY',
custom: 'VARIABLE',
name: 'Variables',
colour: 4,
cssConfig: {
row: 'blocklyTreeRow blocklyTreeRowVariables',
},
},

{
// Function Category
// Procedures Category
kind: 'CATEGORY',
custom: 'PROCEDURE',
name: 'Procedures',
colour: 16,
cssConfig: {
row: 'blocklyTreeRow blocklyTreeRowProcedures',
},
},
],
};
2 changes: 1 addition & 1 deletion plugins/migration/test/rename.mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ suite('Rename', function () {
'1.0.0': [
{
oldName: 'Blockly',
exports: {}
exports: {},
},
{
oldName: 'Blockly.moduleA',
Expand Down
Loading